Package org.gatein.mop.api.workspace

Examples of org.gatein.mop.api.workspace.Navigation


   {
      Site portal = session.getWorkspace().getSite(ObjectType.PORTAL_SITE, "test");
      assertNotNull(portal);

      //
      Navigation rootNavigation = portal.getRootNavigation();
      assertNotNull(rootNavigation);

      //
      Navigation defaultNav = rootNavigation.getChild("default");

      //
      Attributes defaultAttrs = defaultNav.getAttributes();
      assertEquals(1, (int)defaultAttrs.getInteger("priority"));

      //
      Collection<? extends Navigation> childrenNavigations = defaultNav.getChildren();
      assertNotNull(childrenNavigations);
      assertEquals(2, childrenNavigations.size());
      Iterator<? extends Navigation> i = childrenNavigations.iterator();

      //
      assertTrue(i.hasNext());
      Navigation nodeNavigation = i.next();
      assertNotNull(nodeNavigation);
      assertEquals(0, nodeNavigation.getChildren().size());
      assertEquals("node_name", nodeNavigation.getName());
      Described nodeDescribed = nodeNavigation.adapt(Described.class);
      assertEquals("node_label", nodeDescribed.getName());
      Attributes nodeAttrs = nodeNavigation.getAttributes();
      assertEquals("node_uri", nodeAttrs.getString("uri"));
      assertEquals("node_icon", nodeAttrs.getString("icon"));

      //
      assertTrue(nodeNavigation.isAdapted(Visible.class));
      Visible visible = nodeNavigation.adapt(Visible.class);
      GregorianCalendar start = new GregorianCalendar(2000, 2, 21, 1, 33, 0);
      start.setTimeZone(TimeZone.getTimeZone("UTC"));
      assertEquals(start.getTime(), visible.getStartPublicationDate());
      GregorianCalendar end = new GregorianCalendar(2009, 2, 21, 1, 33, 0);
      end.setTimeZone(TimeZone.getTimeZone("UTC"));
      assertEquals(end.getTime(), visible.getEndPublicationDate());
      assertEquals(Visibility.TEMPORAL, visible.getVisibility());

      //
      Link link = nodeNavigation.getLink();
      assertNotNull(link);
   }
View Full Code Here


      {
         Workspace workspace = session.getWorkspace();
         Site site = workspace.getSite(siteType, key.getId());
         if (site != null)
         {
            Navigation nav = site.getRootNavigation();
            Navigation defaultNav = nav.getChild("default");
            if (defaultNav != null)
            {
               return new Mapper(session).load(defaultNav);
            }
         }
View Full Code Here

            throw new IllegalArgumentException("Cannot insert page navigation "
               + " as the corresponding portal " + key.getId() + " with type " + siteType + " does not exist");
         }

         // Delete node descendants first
         Navigation nav = site.getRootNavigation();

         //
         Navigation defaultNav = nav.getChild("default");
         if (defaultNav == null)
         {
            defaultNav = nav.addChild("default");
         }
View Full Code Here

            throw new IllegalArgumentException("Cannot insert page navigation "
               + " as the corresponding portal " + key.getId() + " with type " + siteType + " does not exist");
         }

         // Delete descendants
         Navigation nav = site.getRootNavigation();

         //
         Navigation defaultNav = nav.getChild("default");
         if (defaultNav != null)
         {
            defaultNav.destroy();
         }

         //
         return null;
      }
View Full Code Here

        if (pages != null && !pages.getChildren().isEmpty()) {
            children.add("pages");
            pageOrNav = true;
        }

        Navigation defaultNav = site.getRootNavigation().getChild("default");
        if (defaultNav != null && !defaultNav.getChildren().isEmpty()) {
            children.add("navigation");
            pageOrNav = true;
        }

        if (pageOrNav) {
View Full Code Here

            boolean pageOrNav = false;
            Page pages = site.getRootPage().getChild("pages");
            if (pages != null && !pages.getChildren().isEmpty()) {
                pageOrNav = true;
            }
            Navigation defaultNav = site.getRootNavigation().getChild("default");
            if (defaultNav != null && !defaultNav.getChildren().isEmpty()) {
                pageOrNav = true;
            }

            // TODO: Until invalid site entries without a leading slash is corrected, this is needed to ignore them.
            if (siteType == ObjectType.GROUP_SITE) {
View Full Code Here

    final void removeNavigationData(POMSession session, SiteKey key) {
        removeNavigation(key);
    }

    protected final NodeData loadNode(POMSession session, String nodeId) {
        Navigation navigation = session.findObjectById(ObjectType.NAVIGATION, nodeId);
        if (navigation != null) {
            return new NodeData(navigation);
        } else {
            return null;
        }
View Full Code Here

    protected final NavigationData loadNavigation(POMSession session, SiteKey key) {
        Workspace workspace = session.getWorkspace();
        ObjectType<Site> objectType = objectType(key.getType());
        Site site = workspace.getSite(objectType, key.getName());
        if (site != null) {
            Navigation defaultNavigation = site.getRootNavigation().getChild("default");
            if (defaultNavigation != null) {
                return new NavigationData(key, defaultNavigation);
            } else {
                return NavigationData.EMPTY;
            }
View Full Code Here

*/
public abstract class AbstractNavigationOperationHandler extends AbstractSiteOperationHandler {
    @Override
    protected void execute(OperationContext operationContext, ResultHandler resultHandler, Site site)
            throws ResourceNotFoundException, OperationException {
        Navigation navigation = site.getRootNavigation().getChild("default");
        if (navigation == null)
            throw new ResourceNotFoundException("Navigation does not exist for site " + getSiteKey(site));

        execute(operationContext, resultHandler, navigation);
    }
View Full Code Here

            toUpdate.add(target.handle);
        }

        @Override
        public void onDestroy(NodeContext<N> target, NodeContext<N> parent) {
            Navigation parentNav = session.findObjectById(ObjectType.NAVIGATION, parent.data.id);
            Navigation sourceNav = session.findObjectById(ObjectType.NAVIGATION, target.data.id);

            //
            toEvict.add(parentNav.getObjectId());
            sourceNav.destroy();

            //
            parent.data = new NodeData(parentNav);
            toUpdate.add(parent.handle);
View Full Code Here

TOP

Related Classes of org.gatein.mop.api.workspace.Navigation

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.