Package org.gatein.mop.api.workspace

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


      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
View Full Code Here


      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
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

      {
         children.add("pages");
         pageOrNav = true;
      }

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

         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.
View Full Code Here

      {
         throw new NavigationServiceException(NavigationError.NAVIGATION_NO_SITE);
      }

      //
      Navigation rootNode = site.getRootNavigation();

      //
      Navigation defaultNode = rootNode.getChild("default");
      if (defaultNode == null)
      {
         defaultNode = rootNode.addChild("default");
      }

      //
      NavigationState state = navigation.state;
      if (state != null)
      {
         Integer priority = state.getPriority();
         defaultNode.getAttributes().setValue(MappedAttributes.PRIORITY, priority);
      }

      //
      dataCache.removeNavigationData(session, navigation.key);
View Full Code Here

      {
         throw new NavigationServiceException(NavigationError.NAVIGATION_NO_SITE);
      }

      //
      Navigation rootNode = site.getRootNavigation();
      Navigation defaultNode = rootNode.getChild("default");

      //
      if (defaultNode != null)
      {
         // Invalidate cache
         dataCache.removeNavigation(navigation.key);
         String rootId = navigation.data.rootId;
         if (rootId != null)
         {
            dataCache.removeNodes(Collections.singleton(rootId));
         }

         // Destroy nav
         defaultNode.destroy();

         // Update state
         navigation.data = null;

         //
View Full Code Here

      }

      @Override
      public void onCreate(NodeContext<N> target, NodeContext<N> parent, NodeContext<N> previous, String name) throws NavigationServiceException
      {
         Navigation parentNav = session.findObjectById(ObjectType.NAVIGATION, parent.data.id);
         toEvict.add(parentNav.getObjectId());
         int index = 0;
         if (previous != null)
         {
            Navigation previousNav = session.findObjectById(ObjectType.NAVIGATION, previous.data.id);
            index = previousNav.getIndex() + 1;
         }

         //
         Navigation sourceNav = parentNav.addChild(index, name);

         //
         parent.data = new NodeData(parentNav);

         // Save the handle
         toPersist.put(target.handle, sourceNav.getObjectId());

         //
         target.data = new NodeData(sourceNav);
         target.handle = target.data.id;
         target.name = null;
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

      }

      @Override
      public void onUpdate(NodeContext<N> source, NodeState state) throws NavigationServiceException
      {
         Navigation sourceNav = session.findObjectById(ObjectType.NAVIGATION, source.data.id);

         //
         toEvict.add(sourceNav.getObjectId());
         Workspace workspace = sourceNav.getSite().getWorkspace();
         String reference = state.getPageRef();
         if (reference != null)
         {
            String[] pageChunks = split("::", reference);
            ObjectType<? extends Site> siteType = Mapper.parseSiteType(pageChunks[0]);
            Site site = workspace.getSite(siteType, pageChunks[1]);
            org.gatein.mop.api.workspace.Page target = site.getRootPage().getChild("pages").getChild(pageChunks[2]);
            PageLink link = sourceNav.linkTo(ObjectType.PAGE_LINK);
            link.setPage(target);
         }
         else
         {
            PageLink link = sourceNav.linkTo(ObjectType.PAGE_LINK);
            link.setPage(null);
         }

         //
         Described described = sourceNav.adapt(Described.class);
         described.setName(state.getLabel());

         //
         Visible visible = sourceNav.adapt(Visible.class);
         visible.setVisibility(state.getVisibility());

         //
         visible.setStartPublicationDate(state.getStartPublicationDate());
         visible.setEndPublicationDate(state.getEndPublicationDate());

         //
         Attributes attrs = sourceNav.getAttributes();
         attrs.setValue(MappedAttributes.ICON, state.getIcon());

         //
         source.data = new NodeData(sourceNav);
         source.state = null;
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.