Generates the definitions for the available environments for this webspace.

@param \DOMNode $portalNode
@param Portal $portal
14196
protected function generateEnvironments(\DOMNode $portalNode, Portal $portal)
    {
        foreach ($this->xpath->query('x:environments/x:environment', $portalNode) as $environmentNode) {
            /** @var \DOMNode $environmentNode */
            $environment = new Environment();
            $environment->setType($environmentNode->attributes->getNamedItem('type')->nodeValue);

            $this->generateUrls($environmentNode, $environment);
            $this->generateCustomUrls($environmentNode, $environment);

            $portal->addEnvironment($environment);
        }
    }
383345
public function merge(ServerNodeInterface $serverNode)
    {

        // append the certificate nodes found in the passed server node
        /** @var \AppserverIo\Appserver\Core\Api\Node\CertificateNode $certificate */
        foreach ($serverNode->getCertificates() as $certificate) {
            $this->certificates[] = $certificate;
        }

        // append the virtual host nodes found in the passed server node
        /** @var \AppserverIo\Appserver\Core\Api\Node\VirtualHostNode $virtualHost */
        foreach ($serverNode->getVirtualHosts() as $virtualHost) {
            $this->virtualHosts[] = $virtualHost;
        }

        // append the location nodes found in the passed server node
        /** @var \AppserverIo\Appserver\Core\Api\Node\LocationNode $location */
        foreach ($serverNode->getLocations() as $location) {
            $this->locations[] = $location;
        }

        // append the environment variable nodes found in the passed server node
        /** @var \AppserverIo\Appserver\Core\Api\Node\EnvironmentVariableNode $environmentVariable */
        foreach ($serverNode->getEnvironmentVariables() as $environmentVariable) {
            $this->environmentVariables[] = $environmentVariable;
        }

        // append the rewrite nodes found in the passed server node
        /** @var \AppserverIo\Appserver\Core\Api\Node\RewriteNode $rewrite */
        foreach ($serverNode->getRewrites() as $rewrite) {
            $this->rewrites[] = $rewrite;
        }

        // append the access nodes found in the passed server node
        /** @var \AppserverIo\Appserver\Core\Api\Node\AccessNode $access */
        foreach ($serverNode->getAccesses() as $access) {
            $this->accesses[] = $access;
        }
    }
750587
public function appendConfiguration(ArrayNodeDefinition $rootNode)
    {
        $rootNode
            ->children()
                ->arrayNode('vcs')
                    ->children()
                        ->scalarNode('url')->end()
                        ->arrayNode('export')
                            ->children()
                                ->scalarNode('revfile')->isRequired()->end()
                            ->end()
                        ->end()
                    ->end()
                ->end()
            ->end()
        ;
    }
293137
public static function selectSingleNode(\DOMNode $pNode, $xPath, $arNamespace = null) // <- Retorna
    {
        $rNodeList = self::selectNodes($pNode, $xPath, $arNamespace);

        return $rNodeList->item(0);
    }
1279120
def portalSelf(self):
        """"""
        url = "%s/self" % self.root
        return Portal(url=url,
                      securityHandler=self._securityHandler,
                      proxy_url=self._proxy_url,
                      proxy_port=self._proxy_port,
                      )
457954
protected function generatePath(TreeNodeInterface $node, $parameters)
    {
        if ($this->requestContext->getParameter('_preview') || isset($parameters['_preview'])) {
            return $this->generatePreviewPath($node, $parameters);
        }

        $pathGenerator = new PathGenerator();
        $path = $pathGenerator->generatePath($node, $parameters);

        if ($path === '') {
            return $path;
        }

        $path = $this->generatePathPrefix($path, $node, $parameters);
        $path = $this->generatePathSuffix($path, $node, $parameters);
        $path = $this->generateQuery($path, $node, $parameters);

        return $path;
    }
881535
protected function generatePortals()
    {
        foreach ($this->xpath->query('/x:webspace/x:portals/x:portal') as $portalNode) {
            /** @var \DOMNode $portalNode */
            $portal = new Portal();

            $portal->setName($this->xpath->query('x:name', $portalNode)->item(0)->nodeValue);
            $portal->setKey($this->xpath->query('x:key', $portalNode)->item(0)->nodeValue);

            // set localization on portal
            $this->generatePortalLocalizations($portalNode, $portal);

            $this->webspace->addPortal($portal);
            $portal->setWebspace($this->webspace);

            // set environments
            $this->generateEnvironments($portalNode, $portal);
        }
    }
912883
private function addDoctrineSection(ArrayNodeDefinition $rootNode)
    {
        $doctrineNode = $rootNode->children()->arrayNode('doctrine')->canBeUnset();
        foreach (array('metadata_cache', 'result_cache', 'query_cache', 'second_level_cache') as $type) {
            $doctrineNode
                ->children()
                    ->arrayNode($type)
                        ->canBeUnset()
                        ->children()
                            ->scalarNode('client')->isRequired()->end()
                            ->scalarNode('namespace')->defaultNull()->end()
                        ->end()
                        ->fixXmlConfig('entity_manager')
                        ->children()
                            ->arrayNode('entity_managers')
                                ->defaultValue(array())
                                ->beforeNormalization()->ifString()->then(function($v) { return (array) $v; })->end()
                                ->prototype('scalar')->end()
                            ->end()
                        ->end()
                        ->fixXmlConfig('document_manager')
                        ->children()
                            ->arrayNode('document_managers')
                                ->defaultValue(array())
                                ->beforeNormalization()->ifString()->then(function($v) { return (array) $v; })->end()
                                ->prototype('scalar')->end()
                            ->end()
                        ->end()
                    ->end()
                ->end();
        }
    }
787132
private function createPluginsNode(ArrayNodeDefinition $rootNode): void
    {
        $pluginsNode = $rootNode
            ->children()
                ->arrayNode('plugins')
                ->children();

        foreach ($this->plugins as $plugin) {
            $pluginNode = new ArrayNodeDefinition($plugin->getPluginName());
            $plugin->addConfiguration($pluginNode);

            $pluginsNode->append($pluginNode);
        }
    }
772898
public function getNamespaces(\DOMElement $element = null)
    {
        if ($this->xpath === null) {
            $this->xpath = new \DOMXPath($this);
        }

        if ($element === null) {
            $nodes = $this->xpath->query('namespace::*');
        } else {
            $nodes = $this->xpath->query('namespace::*', $element);
        }

        $ns = array();

        if ($nodes) {
            foreach ($nodes as $node) {
                $arr = $element->getAttribute($node->nodeName);

                if ($arr) {
                    $ns[$node->nodeName] = $arr;
                }
            }

            $nodes = null;
        }

        return $ns;
    }
438428
public function onNodeResourceEventAlterChannels(Event $event)
    {
        if (!$this->groupManager || !$event instanceof ResourceEvent) {
            return;
        }

        $done = [];

        // Fetch site groups, and yes we don't really have a choice here
        $nodes = $this->entityManager->getStorage('node')->loadMultiple($event->getResourceIdList());
        foreach ($nodes as $node) {
            if ($node->group_id) {
                $groupId = (int)$node->group_id;
                $done[$groupId] = $groupId;
            }
        }

        foreach ($done as $groupId) {
            $event->addArbitraryChanId('admin:content:' . $groupId);
        }
    }
1172133
protected function getAdminConfigTreeBuilder(): NodeDefinition
    {
        $builder = new TreeBuilder();
        $node = $builder->root('configurations');
        $adminDefinition = $node
            ->useAttributeAsKey('code')
            ->prototype('array')
            ->performNoDeepMerging()
            ->children();

        $this->appendAdminDefinition($adminDefinition);

        $adminDefinition->end()
            ->end()
            ->end();

        return $node;
    }
1168789
protected function setupTree(ArrayNodeDefinition $rootNode)
    {
        $rootNode
            ->children()

                /**
                 * Bundle config definition.
                 */
                ->integerNode('resolver_priority')
                    ->defaultValue(-8)
                ->end()

                /**
                 * Provider request.
                 */
                ->enumNode('request')
                    ->values([
                        RequestParameterProvider::CURRENT_REQUEST,
                        RequestParameterProvider::MASTER_REQUEST,
                    ])
                    ->defaultValue(RequestParameterProvider::CURRENT_REQUEST)
                ->end()

                /**
                 * Form config definition.
                 */
                ->arrayNode('form')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->booleanNode('active')
                            ->defaultTrue()
                        ->end()
                        ->scalarNode('default_name')
                            ->defaultValue('form')
                        ->end()
                    ->end()
                ->end()

                /**
                 * Flush config definition.
                 */
                ->arrayNode('flush')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->booleanNode('active')
                            ->defaultTrue()
                        ->end()
                        ->scalarNode('default_manager')
                            ->defaultValue('default')
                        ->end()
                    ->end()
                ->end()

                /**
                 * Entity config definition.
                 */
                ->arrayNode('entity')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->booleanNode('active')
                            ->defaultTrue()
                        ->end()
                        ->scalarNode('default_name')
                            ->defaultValue('entity')
                        ->end()
                        ->scalarNode('default_persist')
                            ->defaultTrue()
                        ->end()
                        ->booleanNode('fallback_mapping')
                            ->defaultFalse()
                        ->end()
                         ->scalarNode('default_factory_method')
                            ->defaultValue('create')
                        ->end()
                        ->booleanNode('default_factory_static')
                            ->defaultValue(true)
                        ->end()
                    ->end()
                ->end()

                /**
                 * Bundle config definition.
                 */
                ->arrayNode('json_response')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->booleanNode('active')
                            ->defaultTrue()
                        ->end()
                        ->integerNode('default_status')
                            ->defaultValue(200)
                        ->end()
                        ->integerNode('default_error_status')
                            ->defaultValue(500)
                        ->end()
                        ->arrayNode('default_headers')
                            ->useAttributeAsKey('name')
                            ->prototype('scalar')
                            ->end()
                            ->defaultValue([])
                        ->end()
                    ->end()
                ->end()

                /**
                 * Log config definition.
                 */
                ->arrayNode('log')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->booleanNode('active')
                            ->defaultTrue()
                        ->end()
                        ->enumNode('default_level')
                            ->values([
                                AnnotationLog::LVL_EMERG,
                                AnnotationLog::LVL_ALERT,
                                AnnotationLog::LVL_CRIT,
                                AnnotationLog::LVL_ERR,
                                AnnotationLog::LVL_WARNING,
                                AnnotationLog::LVL_INFO,
                                AnnotationLog::LVL_DEBUG,
                                AnnotationLog::LVL_LOG,
                            ])
                            ->defaultValue(AnnotationLog::LVL_INFO)
                        ->end()
                        ->enumNode('default_execute')
                            ->values([
                                AnnotationLog::EXEC_PRE,
                                AnnotationLog::EXEC_POST,
                                AnnotationLog::EXEC_BOTH,
                            ])
                            ->defaultValue(AnnotationLog::EXEC_PRE)
                        ->end()
                    ->end()
                ->end()

                ->arrayNode('paginator')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->booleanNode('active')
                            ->defaultTrue()
                        ->end()
                        ->scalarNode('default_name')
                            ->defaultValue('paginator')
                        ->end()
                        ->integerNode('default_page')
                            ->defaultValue(1)
                        ->end()
                        ->integerNode('default_limit_per_page')
                            ->defaultValue(10)
                        ->end()
                    ->end()
                ->end()

                /**
                 * Get config definition.
                 */
                ->arrayNode('get')
                    ->addDefaultsIfNotSet()
                        ->children()
                            ->booleanNode('active')
                                ->defaultTrue()
                        ->end()
                    ->end()
                ->end()

                /**
                 * Post config definition.
                 */
                ->arrayNode('post')
                    ->addDefaultsIfNotSet()
                        ->children()
                            ->booleanNode('active')
                                ->defaultTrue()
                            ->end()
                        ->end()
                    ->end()
                ->end()

            ->end();
    }
838482
public function getServerNodeConfiguration(ServerNodeInterface $serverNode)
    {

        // query whether a server signature (software) has been configured
        if ($serverNode->getParam('software') == null) {
            $serverNode->setParam('software', ParamNode::TYPE_STRING, $this->getService()->getServerSignature());
        }

        // add the server node configuration
        return new ServerNodeConfiguration($serverNode);
    }
1109775
protected function convertArrayOfNodesToArrayOfNodeIdentifiersWithPrefix($nodes, $prefix)
    {
        if ($nodes === null) {
            $nodes = [];
        }

        if (!is_array($nodes) && ($nodes instanceof NodeInterface || $nodes instanceof TraversableNodeInterface)) {
            $nodes = [$nodes];
        }

        if (!is_array($nodes) && !$nodes instanceof \Traversable) {
            throw new Exception(sprintf('FlowQuery result, Array or Traversable expected by this helper, given: "%s".', gettype($nodes)), 1437169992);
        }

        $prefixedNodeIdentifiers = [];
        foreach ($nodes as $node) {
            if ($node instanceof NodeInterface) {
                /* @var $node NodeInterface */
                $prefixedNodeIdentifiers[] = $prefix . '_' . $this->renderWorkspaceTagForContextNode($node->getContext()->getWorkspace()->getName()) . '_' . $node->getIdentifier();
            } elseif ($node instanceof TraversableNodeInterface) {
                /* @var $node TraversableNodeInterface */
                $prefixedNodeIdentifiers[] = $prefix . '_' . $this->renderWorkspaceTagForContextNode((string)$node->getContentStreamIdentifier()) . '_' . $node->getNodeAggregateIdentifier();
            } else {
                throw new Exception(sprintf('One of the elements in array passed to this helper was not a Node, but of type: "%s".', gettype($node)), 1437169991);
            }
        }
        return $prefixedNodeIdentifiers;
    }
1151837
@Override
    public IPortalUrlBuilder getPortalUrlBuilderByLayoutNode(
            HttpServletRequest request, String layoutNodeId, UrlType urlType) {
        final IPortletWindowId portletWindowId = getPortletWindowId(request, layoutNodeId);

        return new PortalUrlBuilder(
                this.urlSyntaxProvider, request, layoutNodeId, portletWindowId, urlType);
    }
161813
public function enterNode(Node $node, Environment $environment): Node
    {
        if ($node instanceof ModelNode) {
            $this->assign($node->getSourceContext(), $node->getAttribute('presentation_model'));
        }

        return $node;
    }