Examples of JcrSession


Examples of org.brixcms.jcr.api.JcrSession

    public void createPrototype(Workspace originalWorkspace, String prototypeName) {
        Workspace workspace = brix.getWorkspaceManager().createWorkspace();
        workspace.setAttribute(Brix.WORKSPACE_ATTRIBUTE_TYPE, WORKSPACE_TYPE);
        setPrototypeName(workspace, prototypeName);

        JcrSession originalSession = brix.getCurrentSession(originalWorkspace.getId());
        JcrSession destSession = brix.getCurrentSession(workspace.getId());
        brix.clone(originalSession, destSession);
    }
View Full Code Here

Examples of org.brixcms.jcr.api.JcrSession

        }
        Workspace workspace = brix.getWorkspaceManager().createWorkspace();
        workspace.setAttribute(Brix.WORKSPACE_ATTRIBUTE_TYPE, WORKSPACE_TYPE);
        setPrototypeName(workspace, prototypeName);

        JcrSession destSession = brix.getCurrentSession(workspace.getId());

        JcrUtil.cloneNodes(nodes, destSession.getRootNode());
        destSession.save();
    }
View Full Code Here

Examples of org.brixcms.jcr.api.JcrSession

        List<RepositoryInitializer> initializers = new ArrayList<RepositoryInitializer>();
        initializers.addAll(config.getRegistry().lookupCollection(RepositoryInitializer.POINT));
        initializers.addAll(config.getRegistry().lookupCollection(JcrNodeWrapperFactory.POINT));

        try {
            JcrSession s = getCurrentSession(null);
            for (RepositoryInitializer initializer : initializers) {
                initializer.initializeRepository(this, s);
            }
            s.save();
            s.logout();
        }
        catch (RepositoryException e) {
            throw new RuntimeException("Couldn't initialize repository", e);
        }

        for (Workspace w : getWorkspaceManager().getWorkspaces()) {
            JcrSession s = getCurrentSession(w.getId());
            initWorkspace(w, s);
            s.logout();
        }
    }
View Full Code Here

Examples of org.brixcms.jcr.api.JcrSession

            return Collections.emptyList();
        }
    }

    private BrixNode getRootNode(String workspaceId, boolean createIfNotExist) {
        JcrSession session = brix.getCurrentSession(workspaceId);

        if (session.itemExists(getRootPath()) == false) {
            if (createIfNotExist) {
                BrixNode parent = (BrixNode) session.getItem(brix.getRootPath());
                parent.addNode(ROOT_NODE_NAME, "nt:unstructured");
            } else {
                return null;
            }
        }

        return (BrixNode) session.getItem(getRootPath());
    }
View Full Code Here

Examples of org.brixcms.jcr.api.JcrSession

        Workspace target = sitePlugin.getSiteWorkspace(name, targetState);
        if (target == null) {
            target = sitePlugin.createSite(name, targetState);
        }

        JcrSession sourceSession = brix.getCurrentSession(workspace.getId());
        JcrSession targetSession = brix.getCurrentSession(target.getId());

        brix.clone(sourceSession, targetSession);
    }
View Full Code Here

Examples of org.brixcms.jcr.api.JcrSession

        }
    }

    @Test
    public void testgetNodeByIdentifier() throws RepositoryException {
        JcrSession session = login();

        JcrNode node = session.getRootNode().addNode("node");
        node.addMixin(JcrConstants.MIX_REFERENCEABLE);

        assertNotNull(node.getIdentifier());

        JcrNode node1 = session.getNodeByIdentifier(node.getIdentifier());
        assertNotNull(node1);
        node1.setProperty("property", "value");
    }
View Full Code Here

Examples of org.brixcms.jcr.api.JcrSession

        node1.setProperty("property", "value");
    }

    private JcrSession login() throws RepositoryException {
        Credentials credentials = new SimpleCredentials("admin", "admin".toCharArray());
        JcrSession session = JcrSession.Wrapper.wrap(repo.login(credentials));
        sessions.add(session);
        return session;
    }
View Full Code Here

Examples of org.brixcms.jcr.api.JcrSession

        return session;
    }

    @Test
    public void testgetNodeByUUID() throws RepositoryException {
        JcrSession session = login();

        JcrNode node = session.getRootNode().addNode("node");
        node.addMixin(JcrConstants.MIX_REFERENCEABLE);

        assertNotNull(node.getIdentifier());

        JcrNode node1 = session.getNodeByIdentifier(node.getIdentifier());
        assertNotNull(node1);
        node1.setProperty("property", "value");
    }
View Full Code Here

Examples of org.brixcms.jcr.api.JcrSession

    private final static List<SaveEventListener> listeners = Collections
            .synchronizedList(new ArrayList<SaveEventListener>());

    public static void raiseSaveEvent(Node node) {
        try {
            JcrSession session = JcrSession.Wrapper.wrap(node.getSession(), null);
            JcrNode wrapped = JcrNode.Wrapper.wrap(node, session);
            raiseSaveEvent(wrapped);
        } catch (RepositoryException e) {
            throw new JcrException(e);
        }
View Full Code Here

Examples of org.brixcms.jcr.api.JcrSession

            return new GlobalTilesPanel(panelId, workspaceModel);
        }

        @Override
        public boolean isVisible() {
            JcrSession session = Brix.get().getCurrentSession(
                    getWorkspaceModel().getObject().getId());
            SitePlugin sp = SitePlugin.get();
            return sp.canEditNode(sp.getGlobalContainer(session), Context.ADMINISTRATION);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.