Package org.apache.lenya.cms.repository

Examples of org.apache.lenya.cms.repository.Node


                throw new DocumentBuildException("The document [" + pub.getId() + ":" + area + ":"
                        + uuid + ":" + language + "] already exists!");
            }

            Document document = factory.get(pub, area, uuid, language);
            Node node = document.getRepositoryNode();
            node.lock();

            document.setResourceType(documentType);
            document.setSourceExtension(extension);
            document.setMimeType(mimeType);
View Full Code Here


                if (!test.endsWith("/"))
                    test = test + "/";
                if (test.equals(request)) {
                    docs.add(documents[i]);

                    Node node = documents[i].getRepositoryNode();
                    if (node.isCheckedOut()) {
                        checkedOut.add(node.getCheckoutUserId());
                    }
                    else {
                        checkedOut.add(null);
                    }
                }
View Full Code Here

        try {

            Document doc = getTargetDocument(false);
            docs.add(doc);
           
            Node node = doc.getRepositoryNode();
            if (node.isCheckedOut()) {
                checkedOut.add(node.getCheckoutUserId());
            }
            else {
                checkedOut.add(null);
            }
View Full Code Here

     * @see org.apache.lenya.cms.usecase.AbstractUsecase#getNodesToLock()
     */
    protected Node[] getNodesToLock() throws UsecaseException {
        Node[] nodes = new Node[0];
        if(getSourceDocument() != null) {
            Node node = getSourceDocument().area().getSite().getRepositoryNode();
            nodes = new Node[] { node };
        }
        return nodes;
    }
View Full Code Here

        super.act(redirector, resolver, objectModel, src, parameters);

        HashMap actionMap = new HashMap();

        try {
            Node node = getNode();

      if (!node.isCheckedOut() || !node.getCheckoutUserId().equals(getUsername())) {
        //check out
          getNode().checkout();
      }
    } catch (RepositoryException e) {
      actionMap.put("exception", "RepositoryException");
View Full Code Here

           
            if (revisionNumber == -1) {
                this.content = (ContentHolder) session.getRepositoryItem(factory, sourceUri);
            }
            else {
                Node node = (Node) session.getRepositoryItem(factory, sourceUri);
                this.content = node.getHistory().getRevision(revisionNumber);
            }
           
        } catch (Exception e) {
            throw new SourceException("Creating repository node failed: ", e);
        } finally {
View Full Code Here

        try {
            Collection children = getNode().getChildren();
            java.util.Iterator iterator = children.iterator();
            java.util.Vector newChildren = new java.util.Vector();
            while (iterator.hasNext()) {
                Node child = (Node) iterator.next();
                newChildren.add(new RepositorySource(this.manager,
                        child.getSourceURI(),
                        this.session,
                        getLogger()));
            }
            return newChildren;
        } catch (Exception e) {
View Full Code Here

            Session session = RepositoryUtil.createSession(this.manager, identity, true);
           
            DocumentFactory factory = DocumentUtil.createDocumentFactory(this.manager, session);
            String url = ServletHelper.getWebappURI(request);
            if (factory.isDocument(url)) {
                Node node = factory.getFromURL(url).getRepositoryNode();
                if (node.isCheckedOutBySession(session)) {
                    node.checkin();
                }
            }
            else {
                throw new RuntimeException("The URL [" + url + "] doesn't represent a document.");
            }
View Full Code Here

  public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String src,
        Parameters parameters) throws Exception {
        super.act(redirector, resolver, objectModel, src, parameters);

        HashMap actionMap = new HashMap();
        Node node = getNode();

        if (node.isCheckedOut()) {
            actionMap.put("filename", node.getSourceURI());
            actionMap.put("user", node.getCheckoutUserId());
            return actionMap;
        }
        return null;
    }
View Full Code Here

        if (this.loaded || this.loading) {
            return;
        }

        Node repoNode = getRepositoryNode();

        try {
            repoNode.setPersistable(this);
           
            if (repoNode.exists()) {
                TreeBuilder builder = null;
                try {
                    this.loading = true;
                    builder = (TreeBuilder) this.manager.lookup(TreeBuilder.ROLE);
                    reset();
                    builder.buildTree(this);
                    Assert.isTrue("Latest revision loaded", getRevision() == getRevision(getRepositoryNode()));
                } finally {
                    this.loading = false;
                    if (builder != null) {
                        this.manager.release(builder);
                    }
                }
            }
            this.loaded = true;
            if (!repoNode.exists()) {
                reset();
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
View Full Code Here

TOP

Related Classes of org.apache.lenya.cms.repository.Node

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.