Package org.gatein.mop.api.workspace

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


            }
        }

        @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();
            PageKey reference = state.getPageRef();
            if (reference != null) {
                ObjectType<? extends Site> siteType = Utils.objectType(reference.getSite().getType());
                Site site = workspace.getSite(siteType, reference.getSite().getName());
                org.gatein.mop.api.workspace.Page target = site.getRootPage().getChild("pages").getChild(reference.getName());
                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


        }

        @Override
        public void onMove(NodeContext<N> target, NodeContext<N> from, NodeContext<N> to, NodeContext<N> previous)
                throws NavigationServiceException {
            Navigation sourceNav = session.findObjectById(ObjectType.NAVIGATION, target.data.id);
            Navigation fromNav = session.findObjectById(ObjectType.NAVIGATION, from.data.id);
            Navigation toNav = session.findObjectById(ObjectType.NAVIGATION, to.data.id);

            //
            toEvict.add(sourceNav.getObjectId());
            toEvict.add(fromNav.getObjectId());
            toEvict.add(toNav.getObjectId());
            int index;
            if (previous != null) {
                Navigation previousNav = session.findObjectById(ObjectType.NAVIGATION, previous.data.id);
                index = previousNav.getIndex() + 1;
            } else {
                index = 0;
            }
            toNav.getChildren().add(index, sourceNav);
View Full Code Here

            toUpdate.add(from.handle);
            toUpdate.add(to.handle);
        }

        public void onRename(NodeContext<N> target, NodeContext<N> parent, String name) throws NavigationServiceException {
            Navigation sourceNav = session.findObjectById(ObjectType.NAVIGATION, target.data.id);
            Navigation parentNav = session.findObjectById(ObjectType.NAVIGATION, parent.data.id);

            //
            toEvict.add(sourceNav.getObjectId());
            toEvict.add(parentNav.getObjectId());
            sourceNav.setName(name);

            //
            target.data = new NodeData(sourceNav);
            target.name = 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 (site.getObjectType() != ObjectType.GROUP_SITE || 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;
                }

                String name = site.getName();
                if (name.charAt(0) == '/' && pageOrNav) {
View Full Code Here

                startPublicationDate != null ? startPublicationDate.getTime() : -1,
                endPublicationDate != null ? endPublicationDate.getTime() : -1, visibility, pageRef);

        //
        String parentId;
        Navigation parent = navigation.getParent();
        if (parent != null) {
            parentId = parent.getObjectId();
        } else {
            parentId = null;
        }

        //
View Full Code Here

        ObjectType<Site> objectType = objectType(type);
        Collection<Site> sites = session.getWorkspace().getSites(objectType);

        List<NavigationContext> navigations = new LinkedList<NavigationContext>();
        for (Site site : sites) {
            Navigation defaultNavigation = site.getRootNavigation().getChild("default");
            if (defaultNavigation != null) {
                SiteKey key = new SiteKey(type, site.getName());
                navigations.add(new NavigationContext(new NavigationData(key, defaultNavigation)));
            }
        }
View Full Code Here

        if (site == null) {
            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

        if (site == null) {
            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

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.