Package org.apache.lenya.cms.publication

Examples of org.apache.lenya.cms.publication.SiteTree


        System.out.println("Live document: " + liveDocumentFile.getAbsolutePath());
    assertFalse(liveDocumentFile.exists());

        //TODO evaluation of resources, meta, workflow
       
    SiteTree authoringSitetree = PublicationHelper.getPublication().getTree(Publication.AUTHORING_AREA);
    SiteTreeNode node = authoringSitetree.getNode(DOCUMENT_ID);
    assertNotNull(node);
        System.out.println("Sitetree node with id ["+node.getId()+"] is always in authoring");
    SiteTree liveSitetree = PublicationHelper.getPublication().getTree(Publication.LIVE_AREA);
    SiteTreeNode livenode = liveSitetree.getNode(DOCUMENT_ID);
    assertNull(livenode);
        System.out.println("Sitetree node for document id ["+DOCUMENT_ID+"] was deleted from the live tree");
  }
View Full Code Here


     * @throws ProcessingException
     */
    protected void generateFragment() throws SiteTreeException, SAXException,
            ProcessingException {

        SiteTree siteTree = null;
        if (!this.area.equals(Publication.AUTHORING_AREA)
                && !this.area.equals(Publication.ARCHIVE_AREA)
                && !this.area.equals(Publication.TRASH_AREA)
                && !this.area.equals(Publication.STAGING_AREA)
                && !this.area.equals(Publication.LIVE_AREA)) {
            throw new ProcessingException("Invalid area: " + this.area);
        }
        siteTree = publication.getTree(this.area);

        SiteTreeNode node = siteTree.getNode(this.documentid);
        if (this.getLogger().isDebugEnabled()) {
            this.getLogger().debug(
                    "Node with documentid " + documentid + " found.");
        }
        if (node == null)
View Full Code Here

     * @throws ProcessingException
     */
    protected void generateFragmentInitial(String siteArea)
            throws SiteTreeException, SAXException, ProcessingException {

        SiteTree siteTree = publication.getTree(siteArea);

        String label = "";
        String isFolder = "";

        // FIXME: don't hardcode area label
        if (siteArea.equals(Publication.AUTHORING_AREA))
            label = "Authoring";
        if (siteArea.equals(Publication.ARCHIVE_AREA))
            label = "Archive";
        if (siteArea.equals(Publication.TRASH_AREA))
            label = "Trash";
        if (siteArea.equals(Publication.LIVE_AREA))
            label = "Live";
        if (siteArea.equals(Publication.STAGING_AREA))
            label = "Staging";

        if (siteTree.getTopNodes().length > 0)
            isFolder = "true";
        else
            isFolder = "false";

        this.attributes.clear();
        this.attributes.addAttribute("", ATTR_AREA, ATTR_AREA, "CDATA",
                siteArea);
        this.attributes.addAttribute("", ATTR_FOLDER, ATTR_FOLDER, "CDATA",
                isFolder);
        this.attributes
                .addAttribute("", ATTR_LABEL, ATTR_LABEL, "CDATA", label);

        startNode(NODE_SITE);

        if (area.equals(siteArea)) {
            generateFragmentRecursive(siteTree.getTopNodes(), this.documentid);
        }

        endNode(NODE_SITE);
    }
View Full Code Here

    File documentFile = new File(authoringDirectory, filepath);
        assertTrue(documentFile.exists());
    System.out.println("Document was copied: " + documentFile.getAbsolutePath());

        SiteTree sitetree = PublicationHelper.getPublication().getTree(Publication.AUTHORING_AREA);
        SiteTreeNode node = sitetree.getNode(secdocumentid);
        assertNotNull(node);
        System.out.println("Sitetree node with id " + node.getId() +
            " was created as child of node with id: " + node.getAbsoluteParentId());
    }
View Full Code Here

        }

        creator.init(doctypeConf);

        // add a node to the tree
        SiteTree siteTree = publication.getTree(Publication.AUTHORING_AREA);
        Label[] labels = new Label[1];
        labels[0] = new Label(childname, language);
        siteTree.addNode(parentid, creator.generateTreeId(childid, childType), labels, visibleInNav);

        // Transaction should actually be finished here!
        // Create actual document
        // grab all the parameters from session, request params and
        // sitemap params
        HashMap allParameters = new HashMap();
        String[] names = parameters.getNames();

        for (int i = 0; i < names.length; i++) {
            String name = names[i];
            String value = null;

            try {
                value = parameters.getParameter(name);
            } catch (ParameterException pe) {
                value = null;
            }

            allParameters.put(name, value);
        }

        Enumeration requestParameters = request.getParameterNames();

        while (requestParameters.hasMoreElements()) {
            String requestParameterName = (String) requestParameters.nextElement();

            if (allParameters.containsKey(requestParameterName)) {
                // we do not allow name clashes
                throw new ProcessingException("Name clash in request parameter " +
                    "and sitemap parameter: " + requestParameterName);
            }

            allParameters.put(requestParameterName, request.getParameter(requestParameterName));
        }

        Enumeration sessionAttributeNames = session.getAttributeNames();

        while (sessionAttributeNames.hasMoreElements()) {
            String sessionAttributeName = (String) sessionAttributeNames.nextElement();

            if (allParameters.containsKey(sessionAttributeName)) {
                // we do not allow name clashes
                throw new ProcessingException("Name clash in session attribute " +
                    "and request parameter or sitemap parameter: " + sessionAttributeName);
            }

            allParameters.put(sessionAttributeName, session.getAttribute(sessionAttributeName));
        }

        try {
            creator.create(publication, new File(absoluteDoctypesPath + "samples"),
                new File(publication.getDirectory(), docsPath + parentid), parentid, childid, childType,
                childname, language, allParameters);
        } catch (Exception e) {
            log.error("Creator threw exception: " + e);
            return null;
        }

        // commit (sort of)
        siteTree.save();

        HashMap actionMap = new HashMap();

        return actionMap;
    }
View Full Code Here

        }

        Document liveDocument = getPublication().getAreaVersion(document, Publication.LIVE_AREA);
        Document liveParent = DocumentHelper.getParentDocument(liveDocument);
        if (liveParent != null) {
            SiteTree liveTree = getPublication().getSiteTree(Publication.LIVE_AREA);
            SiteTreeNode liveParentNode = liveTree.getNode(liveParent.getId());
            if (liveParentNode == null) {
                if (log.isDebugEnabled()) {
                    log.debug("Cannot execute task: live parent node does not exist.");
                }
                OK = false;
View Full Code Here

        boolean OK = true;

        Document authoringDocument = getPublication().getAreaVersion(liveDocument, Publication.AUTHORING_AREA);
        OK = OK && canWorkflowFire(authoringDocument);

        SiteTree tree = getPublication().getSiteTree(liveDocument.getArea());
        SiteTreeNode node = tree.getNode(liveDocument.getId());

        if (node == null) {
            throw new ExecutionException(
                "Sitetree node for document [" + liveDocument + "] does not exist!");
        }
View Full Code Here

        }

        Document liveDocument = getPublication().getAreaVersion(document, Publication.LIVE_AREA);
        Document liveParent = DocumentHelper.getParentDocument(liveDocument);
        if (liveParent != null) {
            SiteTree liveTree = getPublication().getSiteTree(Publication.LIVE_AREA);
            SiteTreeNode liveParentNode = liveTree.getNode(liveParent.getId());
            if (liveParentNode == null) {
                log.error("Cannot execute task: live parent node does not exist.");
                OK = false;
            }
        }
View Full Code Here

    assertFalse(firstRcbakFile.exists());
    System.out.println("Backup was deleted: " + firstRcbakFile.getAbsolutePath());
       
        //TODO evaluation of meta, workflow
       
    SiteTree sitetree = PublicationHelper.getPublication().getTree(Publication.AUTHORING_AREA);
    SiteTreeNode node = sitetree.getNode(secdocumentid);
    assertNotNull(node);
    System.out.println("Sitetree node with id "+node.getId()+" was created as child of node with id: " + node.getAbsoluteParentId());
    SiteTreeNode firstnode = sitetree.getNode(FIRST_DOCUMENT_ID);
    assertNull(firstnode);
    System.out.println("Sitetree node for document id "+FIRST_DOCUMENT_ID+" was deleted");
  }
View Full Code Here

     *
     * @throws ProcessingException if the current document cannot be opened.
     */
    public Document[] getInternalReferences() throws ProcessingException {
        ArrayList unpublishedReferences = new ArrayList();
        SiteTree sitetree;
        Pattern internalLinkPattern = getInternalLinkPattern();
        Publication publication = pageEnvelope.getPublication();
        DocumentBuilder builder = publication.getDocumentBuilder();
        try {
            sitetree = publication.getTree(Publication.LIVE_AREA);
            String[] internalLinks =
                Grep.findPattern(
                    pageEnvelope.getDocument().getFile(),
                    internalLinkPattern,
                    1);
            String[] internalLinksLanguages =
                Grep.findPattern(
                    pageEnvelope.getDocument().getFile(),
                    internalLinkPattern,
                    2);

            for (int i = 0; i < internalLinks.length; i++) {
                String docId = internalLinks[i];
                String language = null;

                log.debug("docId: " + docId);
                if (internalLinksLanguages[i] != null) {
                    // trim the leading '_'
                    language = internalLinksLanguages[i].substring(1);
                }

                log.debug("language: " + language);
                SiteTreeNode documentNode = sitetree.getNode(docId);

                if (language == null) {
                    String url =
                        "/"
                            + publication.getId()
View Full Code Here

TOP

Related Classes of org.apache.lenya.cms.publication.SiteTree

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.