Package org.exoplatform.portal.config.model

Examples of org.exoplatform.portal.config.model.NavigationFragment


            navigation.setPriority(priority);

            next = navigator.sibling();
            if (next == Element.PAGE_NODES) {
                for (StaxNavigator<Element> fork : navigator.fork(Element.PAGE_NODES)) {
                    NavigationFragment fragment = new NavigationFragment();
                    navigation.addFragment(fragment);

                    next = fork.child();
                    if (next == Element.PARENT_URI) {
                        String parentUri = fork.getContent();
                        if (parentUri == null) {
                            parentUri = "";
                        } else if (parentUri.charAt(0) == '/') {
                            parentUri = parentUri.substring(1, parentUri.length());
                        }
                        fragment.setParentURI(parentUri);

                        next = fork.sibling();
                    }

                    if (next == Element.NODE) {
                        ArrayList<PageNode> nodes = new ArrayList<PageNode>();
                        for (StaxNavigator<Element> nodeFork : fork.fork(Element.NODE)) {
                            nodes.add(unmarshalNode(nodeFork));
                        }
                        fragment.setNodes(nodes);
                    } else if (next != null) {
                        throw unknownElement(fork);
                    }
                }
            } else if (next != null) {
View Full Code Here


    }

    private void merge(PageNavigation navigation, PageNavigation result) {
        for (NavigationFragment fragment : result.getFragments()) {
            if (fragment.getParentURI() != null) {
                NavigationFragment found = findFragment(navigation, fragment.getParentURI());
                if (found == null) {
                    navigation.addFragment(fragment);
                } else {
                    found.getNodes().addAll(fragment.getNodes());
                }
            } else {
                navigation.addFragment(fragment);
            }
        }
View Full Code Here

    }

    private void merge(PageNavigation navigation, PageNavigation result) {
        for (NavigationFragment fragment : result.getFragments()) {
            if (fragment.getParentURI() != null) {
                NavigationFragment found = findFragment(navigation, fragment.getParentURI());
                if (found == null) {
                    navigation.addFragment(fragment);
                } else {
                    found.getNodes().addAll(fragment.getNodes());
                }
            } else {
                navigation.addFragment(fragment);
            }
        }
View Full Code Here

            @SuppressWarnings("unchecked")
            NodeContext<NodeContext<?>> childNode = (NodeContext<NodeContext<?>>) child;
            children.add(createPageNode(service, childNode));
        }

        NavigationFragment fragment = new NavigationFragment();
        fragment.setNodes(children);
        pageNavigation.addFragment(fragment);

        return pageNavigation;
    }
View Full Code Here

        pageNavigation.setOwnerId(navigation.getKey().getName());

        ArrayList<PageNode> children = new ArrayList<PageNode>(1);
        children.add(createPageNode(service, node));

        NavigationFragment fragment = new NavigationFragment();
        StringBuilder parentUri = new StringBuilder("");
        getPath(node.getParent(), parentUri);
        fragment.setParentURI(parentUri.toString());
        fragment.setNodes(children);

        pageNavigation.addFragment(fragment);

        return pageNavigation;
    }
View Full Code Here

        }
    }

    private void unmarshalPageNode(PageNavigation navigation, StaxNavigator<Element> navigator, Element element) throws StaxNavException {
        for (StaxNavigator<Element> fork : navigator.fork(Element.PAGE_NODES)) {
            NavigationFragment fragment = new NavigationFragment();
            navigation.addFragment(fragment);

            element = fork.child();
            if (element == Element.PARENT_URI) {
                String parentUri = fork.getContent();
                if (parentUri == null) {
                    parentUri = "";
                } else if (parentUri.charAt(0) == '/') {
                    parentUri = parentUri.substring(1, parentUri.length());
                }
                fragment.setParentURI(parentUri);

                element = fork.sibling();
            }

            if (element == Element.NODE) {
                ArrayList<PageNode> nodes = new ArrayList<PageNode>();
                for (StaxNavigator<Element> nodeFork : fork.fork(Element.NODE)) {
                    nodes.add(unmarshalNode(nodeFork));
                }
                fragment.setNodes(nodes);
            } else if (element != null) {
                throw unknownElement(fork);
            }
        }
    }
View Full Code Here

   {
      for (NavigationFragment fragment : result.getFragments())
      {
         if (fragment.getParentURI() != null)
         {
            NavigationFragment found = findFragment(navigation, fragment.getParentURI());
            if (found == null)
            {
               navigation.addFragment(fragment);
            }
            else
            {
               found.getNodes().addAll(fragment.getNodes());
            }
         }
         else
         {
            navigation.addFragment(fragment);
View Full Code Here

         @SuppressWarnings("unchecked")
         NodeContext<NodeContext<?>> childNode = (NodeContext<NodeContext<?>>) child;
         children.add(createPageNode(service, childNode));
      }

      NavigationFragment fragment = new NavigationFragment();
      fragment.setNodes(children);
      pageNavigation.addFragment(fragment);

      return pageNavigation;
   }
View Full Code Here

      pageNavigation.setOwnerId(navigation.getKey().getName());

      ArrayList<PageNode> children = new ArrayList<PageNode>(1);
      children.add(createPageNode(service, node));

      NavigationFragment fragment = new NavigationFragment();
      StringBuilder parentUri = new StringBuilder("");
      getPath(node.getParent(), parentUri);
      fragment.setParentURI(parentUri.toString());
      fragment.setNodes(children);

      pageNavigation.addFragment(fragment);

      return pageNavigation;
   }
View Full Code Here

         next = navigator.sibling();
         if (next == Element.PAGE_NODES)
         {
            for (StaxNavigator<Element> fork: navigator.fork(Element.PAGE_NODES))
            {
               NavigationFragment fragment = new NavigationFragment();
               navigation.addFragment(fragment);

               next = fork.child();
               if (next == Element.PARENT_URI)
               {
                  String parentUri = fork.getContent();
                  if (parentUri == null)
                  {
                     parentUri = "";
                  }
                  else if (parentUri.charAt(0) == '/')
                  {
                     parentUri = parentUri.substring(1, parentUri.length());
                  }
                  fragment.setParentURI(parentUri);

                  next = fork.sibling();
               }

               if (next == Element.NODE)
               {
                  ArrayList<PageNode> nodes = new ArrayList<PageNode>();
                  for (StaxNavigator<Element> nodeFork : fork.fork(Element.NODE))
                  {
                     nodes.add(unmarshalNode(nodeFork));
                  }
                  fragment.setNodes(nodes);
               }
               else if (next != null)
               {
                  throw unknownElement(fork);
               }
View Full Code Here

TOP

Related Classes of org.exoplatform.portal.config.model.NavigationFragment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.