Upgrades the given block property to the new URL representation.

@param BlockMetadata $blockProperty
@param array $components
@param PropertyValue $propertyValue
@param bool $addScheme
193981
private function upgradeBlockProperty(
        BlockMetadata $blockProperty,
        array $components,
        PropertyValue $propertyValue,
        $addScheme
    ) {
        $componentNames = array_map(
            function($item) {
                return $item['component']->getName();
            },
            $components
        );

        $value = $propertyValue->getValue();
        foreach ($value as &$item) {
            if (!in_array($item['type'], $componentNames)) {
                continue;
            }

            foreach ($components[$item['type']]['children'] as $child) {
                if (!isset($item[$child->getName()])) {
                    continue;
                }

                if ($addScheme) {
                    $item[$child->getName()] = $this->upgradeUrl($item[$child->getName()]);
                } else {
                    $item[$child->getName()] = $this->downgradeUrl($item[$child->getName()]);
                }
            }
        }

        $propertyValue->setValue($value);
    }
337277
public void updateToRemovedBlock(boolean add, long blockId) {
    if (add) {
      if (mBlocks.contains(blockId)) {
        mToRemoveBlocks.add(blockId);
      }
    } else {
      mToRemoveBlocks.remove(blockId);
    }
  }
941919
private function iterateStructures($addScheme)
    {
        $properties = [];

        // find templates containing URL fields
        $structureMetadatas = array_merge(
            $this->structureMetadataFactory->getStructures('page'),
            $this->structureMetadataFactory->getStructures('snippet')
        );

        $structureMetadatas = array_filter(
            $structureMetadatas,
            function(StructureMetadata $structureMetadata) use (&$properties) {
                $structureName = $structureMetadata->getName();
                $this->findUrlProperties($structureMetadata, $properties);

                return !empty($properties[$structureName]) || !empty($blockProperties[$structureName]);
            }
        );

        foreach ($structureMetadatas as $structureMetadata) {
            $this->iterateStructureNodes(
                $structureMetadata,
                $properties[$structureMetadata->getName()],
                $addScheme
            );
        }

        $this->documentManager->flush();
    }
354290
private void appendPropertiesToBlock(List<MemberDefinition> props, Node block, String basePath) {
    for (MemberDefinition prop : props) {
      Node propertyNode =
          IR.exprResult(NodeUtil.newQName(compiler, basePath + prop.name.getString()));

      // If a property string is quoted, make sure the added prototype properties are also quoted
      if (prop.name.isQuotedString()) {
        continue;
      }

      propertyNode.useSourceInfoIfMissingFromForTree(prop.name);
      JSDocInfoBuilder info = JSDocInfoBuilder.maybeCopyFrom(prop.info);

      JSTypeExpression propType = PolymerPassStaticUtils.getTypeFromProperty(prop, compiler);
      if (propType == null) {
        return;
      }
      info.recordType(propType);
      propertyNode.getFirstChild().setJSDocInfo(info.build());

      block.addChildToBack(propertyNode);
    }
  }
1118445
private function addAllOfProperty(Schema $childSchema, Schema $parentSchema)
    {
        $currentSchema = new Schema(['_context' => $childSchema->_context]);

        $currentSchema->mergeProperties($childSchema);

        $defaultValues = get_class_vars(Schema::class);

        foreach (get_object_vars($currentSchema) as $property => $val) {
            $childSchema->{$property} = $defaultValues[$property];
        }

        $childSchema->schema = $currentSchema->schema;
        unset($currentSchema->schema);
        if ($childSchema->allOf === UNDEFINED) {
            $childSchema->allOf = [];
        }
        $childSchema->allOf[] = new Schema(
            [
            '_context' => $parentSchema->_context,
            'ref' => Components::SCHEMA_REF . $parentSchema->schema
            ]
        );
        $childSchema->allOf[] = $currentSchema;
    }
567011
public function updateBlock(Block $block): void
    {
        $query = $this->connection->createQueryBuilder();
        $query
            ->update('ngbm_block')
            ->set('layout_id', ':layout_id')
            ->set('depth', ':depth')
            ->set('path', ':path')
            ->set('parent_id', ':parent_id')
            ->set('placeholder', ':placeholder')
            ->set('position', ':position')
            ->set('definition_identifier', ':definition_identifier')
            ->set('view_type', ':view_type')
            ->set('item_view_type', ':item_view_type')
            ->set('name', ':name')
            ->set('translatable', ':translatable')
            ->set('main_locale', ':main_locale')
            ->set('always_available', ':always_available')
            ->set('config', ':config')
            ->where(
                $query->expr()->eq('id', ':id')
            )
            ->setParameter('id', $block->id, Type::INTEGER)
            ->setParameter('layout_id', $block->layoutId, Type::INTEGER)
            ->setParameter('depth', $block->depth, Type::STRING)
            ->setParameter('path', $block->path, Type::STRING)
            ->setParameter('parent_id', $block->parentId, Type::INTEGER)
            ->setParameter('placeholder', $block->placeholder, Type::STRING)
            ->setParameter('position', $block->position, Type::INTEGER)
            ->setParameter('definition_identifier', $block->definitionIdentifier, Type::STRING)
            ->setParameter('view_type', $block->viewType, Type::STRING)
            ->setParameter('item_view_type', $block->itemViewType, Type::STRING)
            ->setParameter('name', $block->name, Type::STRING)
            ->setParameter('translatable', $block->isTranslatable, Type::BOOLEAN)
            ->setParameter('main_locale', $block->mainLocale, Type::STRING)
            ->setParameter('always_available', $block->alwaysAvailable, Type::BOOLEAN)
            ->setParameter('config', $block->config, Type::JSON_ARRAY);

        $this->applyStatusCondition($query, $block->status);

        $query->execute();
    }
815456
private function doWrite(
        NodeInterface $node,
        PropertyInterface $property,
        $userId,
        $webspaceKey,
        $languageCode,
        $segmentKey,
        $isImport = false
    ) {
        if ($property->getIsBlock()) {
            /** @var BlockPropertyInterface $blockProperty */
            $blockProperty = $property;
            while (!($blockProperty instanceof BlockPropertyInterface)) {
                $blockProperty = $blockProperty->getProperty();
            }

            $data = $blockProperty->getValue();

            if (!$blockProperty->getIsMultiple()) {
                $data = [$data];
            }

            $data = array_filter($data);

            $len = count($data);

            // init properties
            $typeProperty = new Property('type', '', 'text_line');
            $lengthProperty = new Property('length', '', 'text_line');

            //save length
            $lengthProperty->setValue($len);
            $contentType = $this->contentTypeManager->get($lengthProperty->getContentTypeName());
            $contentType->write(
                $node,
                new BlockPropertyWrapper($lengthProperty, $property),
                $userId,
                $webspaceKey,
                $languageCode,
                $segmentKey
            );

            for ($i = 0; $i < $len; ++$i) {
                $blockPropertyType = $blockProperty->getProperties($i);

                // save type property
                $this->writeProperty(
                    $typeProperty,
                    $property,
                    $blockPropertyType->getName(),
                    $i,
                    $node,
                    $userId,
                    $webspaceKey,
                    $languageCode,
                    $segmentKey,
                    $isImport
                );

                foreach ($blockProperty->getProperties($i)->getChildProperties() as $subProperty) {
                    $this->writeProperty(
                        $subProperty,
                        $property,
                        $subProperty->getValue(),
                        $i,
                        $node,
                        $userId,
                        $webspaceKey,
                        $languageCode,
                        $segmentKey,
                        $isImport
                    );
                }
            }
        } else {
            throw new UnexpectedPropertyType($property, $this);
        }
    }
91578
protected function createProperty(Component $parentComponent, $name, $parameters, $type, $value)
    {
        $property = $this->root->createProperty(
            $name,
            null,
            $parameters,
            $type
        );
        $parentComponent->add($property);
        $property->setXmlValue($value);
    }
448832
protected function updateSmartContentStructure(
        array &$structureArray,
        PropertyMetadata $property,
        $localeSource,
        $localeDestination
    ) {
        /** @var PropertyParameter $parameter */
        foreach ($property->getParameters() as $parameter) {
            if (!array_key_exists($property->getName(), $structureArray)) {
                continue;
            }

            if ('provider' !== $parameter['name'] || 'content' !== $parameter['value']) {
                continue;
            }

            if (!array_key_exists('dataSource', $structureArray[$property->getName()])) {
                continue;
            }

            $targetDocumentDestination = $this->getTargetDocumentDestination(
                $structureArray[$property->getName()]['dataSource'],
                $localeSource,
                $localeDestination
            );

            if (!$targetDocumentDestination) {
                continue;
            }

            $structureArray[$property->getName()]['dataSource'] = $targetDocumentDestination->getUuid();
        }
    }
498167
protected function parseProperties(Component $parentComponent, $propertyNamePrefix = '')
    {
        foreach ($this->pointer ?: [] as $xmlProperty) {
            list($namespace, $tagName) = SabreXml\Service::parseClarkNotation($xmlProperty['name']);

            $propertyName = $tagName;
            $propertyValue = [];
            $propertyParameters = [];
            $propertyType = 'text';

            // A property which is not part of the standard.
            if (self::XCAL_NAMESPACE !== $namespace
                && self::XCARD_NAMESPACE !== $namespace) {
                $propertyName = 'xml';
                $value = '<'.$tagName.' xmlns="'.$namespace.'"';

                foreach ($xmlProperty['attributes'] as $attributeName => $attributeValue) {
                    $value .= ' '.$attributeName.'="'.str_replace('"', '\"', $attributeValue).'"';
                }

                $value .= '>'.$xmlProperty['value'].'</'.$tagName.'>';

                $propertyValue = [$value];

                $this->createProperty(
                    $parentComponent,
                    $propertyName,
                    $propertyParameters,
                    $propertyType,
                    $propertyValue
                );

                continue;
            }

            // xCard group.
            if ('group' === $propertyName) {
                if (!isset($xmlProperty['attributes']['name'])) {
                    continue;
                }

                $this->pointer = &$xmlProperty['value'];
                $this->parseProperties(
                    $parentComponent,
                    strtoupper($xmlProperty['attributes']['name']).'.'
                );

                continue;
            }

            // Collect parameters.
            foreach ($xmlProperty['value'] as $i => $xmlPropertyChild) {
                if (!is_array($xmlPropertyChild)
                    || 'parameters' !== static::getTagName($xmlPropertyChild['name'])) {
                    continue;
                }

                $xmlParameters = $xmlPropertyChild['value'];

                foreach ($xmlParameters as $xmlParameter) {
                    $propertyParameterValues = [];

                    foreach ($xmlParameter['value'] as $xmlParameterValues) {
                        $propertyParameterValues[] = $xmlParameterValues['value'];
                    }

                    $propertyParameters[static::getTagName($xmlParameter['name'])]
                        = implode(',', $propertyParameterValues);
                }

                array_splice($xmlProperty['value'], $i, 1);
            }

            $propertyNameExtended = ($this->root instanceof VCalendar
                                      ? 'xcal'
                                      : 'xcard').':'.$propertyName;

            switch ($propertyNameExtended) {
                case 'xcal:geo':
                    $propertyType = 'float';
                    $propertyValue['latitude'] = 0;
                    $propertyValue['longitude'] = 0;

                    foreach ($xmlProperty['value'] as $xmlRequestChild) {
                        $propertyValue[static::getTagName($xmlRequestChild['name'])]
                            = $xmlRequestChild['value'];
                    }
                    break;

                case 'xcal:request-status':
                    $propertyType = 'text';

                    foreach ($xmlProperty['value'] as $xmlRequestChild) {
                        $propertyValue[static::getTagName($xmlRequestChild['name'])]
                            = $xmlRequestChild['value'];
                    }
                    break;

                case 'xcal:freebusy':
                    $propertyType = 'freebusy';
                    // We don't break because we only want to set
                    // another property type.

                    // no break
                case 'xcal:categories':
                case 'xcal:resources':
                case 'xcal:exdate':
                    foreach ($xmlProperty['value'] as $specialChild) {
                        $propertyValue[static::getTagName($specialChild['name'])]
                            = $specialChild['value'];
                    }
                    break;

                case 'xcal:rdate':
                    $propertyType = 'date-time';

                    foreach ($xmlProperty['value'] as $specialChild) {
                        $tagName = static::getTagName($specialChild['name']);

                        if ('period' === $tagName) {
                            $propertyParameters['value'] = 'PERIOD';
                            $propertyValue[] = implode('/', $specialChild['value']);
                        } else {
                            $propertyValue[] = $specialChild['value'];
                        }
                    }
                    break;

                default:
                    $propertyType = static::getTagName($xmlProperty['value'][0]['name']);

                    foreach ($xmlProperty['value'] as $value) {
                        $propertyValue[] = $value['value'];
                    }

                    if ('date' === $propertyType) {
                        $propertyParameters['value'] = 'DATE';
                    }
                    break;
            }

            $this->createProperty(
                $parentComponent,
                $propertyNamePrefix.$propertyName,
                $propertyParameters,
                $propertyType,
                $propertyValue
            );
        }
    }
1037741
public function updateProperty(\ReflectionProperty $reflectionProperty, Schema $property)
    {
        $annotations = $this->annotationsReader->getPropertyAnnotations($reflectionProperty);

        foreach ($annotations as $annotation) {
            if ($annotation instanceof Assert\NotBlank || $annotation instanceof Assert\NotNull) {
                // The field is required
                if (null === $this->schema) {
                    continue;
                }

                $propertyName = $this->getSchemaPropertyName($property);
                if (null === $propertyName) {
                    continue;
                }

                $existingRequiredFields = $this->schema->getRequired() ?? [];
                $existingRequiredFields[] = $propertyName;

                $this->schema->setRequired(array_values(array_unique($existingRequiredFields)));
            } elseif ($annotation instanceof Assert\Length) {
                $property->setMinLength($annotation->min);
                $property->setMaxLength($annotation->max);
            } elseif ($annotation instanceof Assert\Regex) {
                $this->appendPattern($property, $annotation->getHtmlPattern());
            } elseif ($annotation instanceof Assert\Count) {
                $property->setMinItems($annotation->min);
                $property->setMaxItems($annotation->max);
            } elseif ($annotation instanceof Assert\Choice) {
                $property->setEnum($annotation->callback ? call_user_func(is_array($annotation->callback) ? $annotation->callback : [$reflectionProperty->class, $annotation->callback]) : $annotation->choices);
            } elseif ($annotation instanceof Assert\Expression) {
                $this->appendPattern($property, $annotation->message);
            } elseif ($annotation instanceof Assert\Range) {
                $property->setMinimum($annotation->min);
                $property->setMaximum($annotation->max);
            } elseif ($annotation instanceof Assert\LessThan) {
                $property->setExclusiveMaximum($annotation->value);
            } elseif ($annotation instanceof Assert\LessThanOrEqual) {
                $property->setMaximum($annotation->value);
            }
        }
    }
86762
protected function buildExtendedEntityPropertyHintTypeMap(array $propertySchema, DocBlockHelper $helper) {
		$propertyHintMap = [];

		foreach ($propertySchema as $property => $info) {
			if ($info['kind'] === 'column') {
				$type = $this->columnTypeToHintType($info['type']);
				if ($type === null) {
					continue;
				}

				$propertyHintMap[$property] = $helper->columnTypeNullable($info, $type);
			}
		}

		return $propertyHintMap;
	}
64481
public function setCustomProperty($propertyName,$propertyValue='',$propertyType=NULL) {
        if (($propertyType === NULL) || (!in_array($propertyType,array(self::PROPERTY_TYPE_INTEGER,
                                                                       self::PROPERTY_TYPE_FLOAT,
                                                                       self::PROPERTY_TYPE_STRING,
                                                                       self::PROPERTY_TYPE_DATE,
                                                                       self::PROPERTY_TYPE_BOOLEAN)))) {
            if ($propertyValue === NULL) {
                $propertyType = self::PROPERTY_TYPE_STRING;
            } elseif (is_float($propertyValue)) {
                $propertyType = self::PROPERTY_TYPE_FLOAT;
            } elseif(is_int($propertyValue)) {
                $propertyType = self::PROPERTY_TYPE_INTEGER;
            } elseif (is_bool($propertyValue)) {
                $propertyType = self::PROPERTY_TYPE_BOOLEAN;
            } else {
                $propertyType = self::PROPERTY_TYPE_STRING;
            }
        }

        $this->_customProperties[$propertyName] = array('value' => $propertyValue, 'type' => $propertyType);
        return $this;
    }
203214
public function createBlock($component, array $attributes = array())
    {
        $siteManager = $this->container->get('open_orchestra_display.manager.context');
        $displayBlockManager = $this->container->get('open_orchestra_display.display_block_manager');
        $blockClass = $this->container->getParameter('open_orchestra_model.document.block.class');

        /** @var BlockInterface $block */
        $block = new $blockClass;
        $block->setComponent($component);
        $block->setId(uniqid(BlockInterface::TEMP_ID_PREFIX));
        $block->setTransverse(false);
        $block->setSiteId($siteManager->getSiteId());
        $block->setLanguage($siteManager->getSiteLanguage());
        $block->setAttributes($attributes);

        return $displayBlockManager->show($block)->getContent();
    }
387104
@Override
	public void updateProperties( Dictionary<?,?> properties ) {

		// Ignore iPojo properties
		final List<String> propertiesToSkip = Arrays.asList(
				"component",
				"felix.fileinstall.filename" );

		Map<String,String> map = new HashMap<> ();
		for( Enumeration<?> en = properties.keys(); en.hasMoreElements(); ) {

			Object key = en.nextElement();
			String keyAsString = String.valueOf( key );
			if( propertiesToSkip.contains( keyAsString ))
				continue;

			// "null" are not acceptable values in dictionaries
			// (OSGi often use Hash tables)
			Object value = properties.get( key );
			map.put( keyAsString, String.valueOf( value ));
		}

		this.cache.clear();
		this.cache.putAll( map );
		this.logger.fine( "Preferences were updated in bulk mode." );
	}
49922
public function addUpgraded(DOMElement $el, $property) {
		if ( !is_array($property) ) {
			$property = array($property);
		}

		// add element to list of upgraded elements
		if ( !$this->upgraded->contains($el) ) {
			$this->upgraded->attach($el, $property);
		} else {
			$this->upgraded[$el] = array_merge($this->upgraded[$el], $property);
		}
	}
980637
public function addProperty(Property $property) {
        $properties = $this->getProperties();
        $properties[] = $property;
        $this->setProperties($properties);
    }