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


        targetNode.setVisible(sourceNode.isVisible());
    }

    protected void copyRevisions(Document sourceDoc, Document targetDoc) throws PublicationException {
        try {
            Node targetNode = targetDoc.getRepositoryNode();
            targetNode.copyRevisionsFrom(sourceDoc.getRepositoryNode());
        } catch (Exception e) {
            throw new PublicationException(e);
        }
    }
View Full Code Here

    public boolean exists(DocumentFactory factory, Publication pub, String area, String uuid,
            String language) throws PublicationException {
        String sourceUri = DocumentImpl.getSourceURI(pub, area, uuid, language);
        try {
            Node node = DocumentImpl.getRepositoryNode(this.manager, factory, sourceUri);
            return node.exists();
        } catch (RepositoryException e) {
            throw new PublicationException(e);
        }
    }
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

            siteManager = (SiteManager) selector.select(doc.getPublication().getSiteManagerHint());
            resolver = (SourceResolver) getManager().lookup(SourceResolver.ROLE);

            String path = doc.getPath();

            Node node = siteManager.getSiteStructure(doc.getFactory(),
                    doc.getPublication(),
                    doc.getArea()).getRepositoryNode();

            if (!node.isLocked()) {
                node.lock();
            }

            Document newDoc;
/*
            String docId = doc.getUUID();
View Full Code Here

            entry.setValue(KEY_WORKFLOW_STATE, state);
        } else {
            entry.setValue(KEY_WORKFLOW_STATE, "");
        }

        Node node = doc.getRepositoryNode();
        if (node.isCheckedOut()) {
            entry.setValue(KEY_CHECKED_OUT, node.getCheckoutUserId());
        } else {
            entry.setValue(KEY_CHECKED_OUT, "");
        }
        return entry;
    }
View Full Code Here

                }
                nodes.add(siteManager.getSiteStructure(factory, pub, areas[i]).getRepositoryNode());
            }

            for (Iterator i = nodes.iterator(); i.hasNext();) {
                Node node = (Node) i.next();
                final String lenyaUri = node.getSourceURI();
                final String sourcePath = lenyaUri.substring("lenya://".length());
                final String contextUri = "context://" + sourcePath;
                final String jcrUri = "jcr://" + sourcePath;
                if (SourceUtil.exists(contextUri, this.manager)) {
                    SourceUtil.copy(resolver, contextUri, jcrUri);
View Full Code Here

        if (this.loaded) {
            return;
        }

        Node repoNode = getRepositoryNode();

        try {
            repoNode.setPersistable(this);
           
            if (repoNode.exists()) {
                org.w3c.dom.Document xml = DocumentHelper.readDocument(repoNode.getInputStream());

                NamespaceHelper helper = new NamespaceHelper(NAMESPACE, "", xml);
                Assert.isTrue("document element is site", xml.getDocumentElement().getLocalName()
                        .equals("site"));
                this.loading = true;
                reset();
                loadNodes(this.root, helper, xml.getDocumentElement());
                this.loading = false;
            }

            if (!repoNode.exists()) {
                reset();
            }

            this.loaded = true;
View Full Code Here

    public synchronized void save() throws RepositoryException {
        if (loading || !changed) {
            return;
        }
        try {
            Node repoNode = getRepositoryNode();
            NamespaceHelper helper = new NamespaceHelper(NAMESPACE, "", "site");

            int revision = getRevision(repoNode) + 1;
            helper.getDocument().getDocumentElement().setAttribute("revision",
                    Integer.toString(revision));

            saveNodes(getRoot(), helper, helper.getDocument().getDocumentElement());
            helper.save(repoNode.getOutputStream());
        } catch (RuntimeException e) {
            throw e;
        } catch (Exception e) {
            throw new RepositoryException(e);
        }
View Full Code Here

        if (this.loaded) {
            return;
        }

        Node repoNode = getRepositoryNode();

        try {
            repoNode.setPersistable(this);
           
            // lastModified check is necessary for clustering, but can cause 404s
            // because of the 1s file system last modification granularity
            if (repoNode.exists() /* && repoNode.getLastModified() > this.lastModified */) {
                long lastModified = repoNode.getLastModified();
                org.w3c.dom.Document xml = DocumentHelper.readDocument(repoNode.getInputStream());

                NamespaceHelper helper = new NamespaceHelper(NAMESPACE, "", xml);
                Assert.isTrue("document element is site", xml.getDocumentElement().getLocalName()
                        .equals("site"));
                this.loading = true;
                reset();
                loadNodes(this.root, helper, xml.getDocumentElement());
                this.loading = false;
                this.lastModified = lastModified;
            }

            if (!repoNode.exists() && this.lastModified > -1) {
                reset();
                this.lastModified = -1;
            }

            this.loaded = true;
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.