Package org.apache.lenya.cms.publication

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


    protected void addToMetaData(String versionString) {
        try {
            String[] areas = getDocument().getPublication().getAreaNames();
            for (int i = 0; i < areas.length; i++) {
                if (getDocument().existsAreaVersion(areas[i])) {
                    Document doc = getDocument().getAreaVersion(areas[i]);
                    MetaData meta = doc.getMetaData(METADATA_NAMESPACE);
                    meta.addValue(METADATA_VERSION, versionString);
                }
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
View Full Code Here


            String uuid = nodes[n].getUuid();
            if (uuid != null && uuid.startsWith("/")) {
                String[] languages = nodes[n].getLanguages();
                for (int l = 0; l < languages.length; l++) {
                    path2langs.put(nodes[n].getPath(), languages);
                    Document doc = area.getDocument(nodes[n].getPath(), languages[l]);
                    migrateDocument(doc);
                }
            }
        }
        verifyMigration(area, path2langs);
View Full Code Here

        SiteStructure site = area.getSite();
        for (Iterator i = path2langs.keySet().iterator(); i.hasNext();) {
            String path = (String) i.next();
            String[] langs = (String[]) path2langs.get(path);
            SiteNode node = site.getNode(path);
            Document migratedDoc = node.getLink(node.getLanguages()[0]).getDocument();
            String[] migratedLangs = migratedDoc.getLanguages();
            assertEquals(Arrays.asList(langs), Arrays.asList(migratedLangs));
        }
    }
View Full Code Here

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

            Document newDoc;
/*
            String docId = doc.getUUID();
            if (this.migratedDocs.containsKey(docId)) {
                Document migratedDoc = (Document) this.migratedDocs.get(docId);
                newDoc = docManager.addVersion(migratedDoc, doc.getArea(), doc.getLanguage(), false);
View Full Code Here

            Element[] documentElements = helper
                    .getChildren(collectionElement, ELEMENT_DOCUMENT);

            for (int i = 0; i < documentElements.length; i++) {
                Element documentElement = documentElements[i];
                Document document = loadDocument(documentElement);
                this.documentsList.add(document);
            }
           
            if (collectionElement.hasAttribute(ATTRIBUTE_TYPE)) {
                this.type = collectionElement.getAttribute(ATTRIBUTE_TYPE);
View Full Code Here

     * @return A document.
     * @throws DocumentBuildException when something went wrong.
     */
    protected Document loadDocument(Element documentElement) throws DocumentBuildException {
        String documentId = documentElement.getAttribute(ATTRIBUTE_UUID);
        Document document = getDelegate().getFactory().get(getDelegate().getPublication(),
                getDelegate().getArea(), documentId, getDelegate().getLanguage());
        return document;
    }
View Full Code Here

        super.doCheckPreconditions();
        if (hasErrors()) {
            return;
        }

        Document doc = getSourceDocument();
        if (!getSourceDocument().getArea().equals(Publication.AUTHORING_AREA)) {
            addErrorMessage("This usecase can only be invoked in the authoring area!");
        }

        UsecaseWorkflowHelper.checkWorkflow(this.manager, this, getEvent(), doc,
View Full Code Here

    /**
     * @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters()
     */
    protected void initParameters() {
        super.initParameters();
        Document document = getSourceDocument();
        try {
            if (document != null && document.exists()) {
                setParameter(DOCUMENT_ID, document.getUUID());
                setParameter(LABEL, document.getLink().getLabel());
            }
        } catch (final DocumentException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

     * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
     */
    protected void doExecute() throws Exception {
        super.doExecute();

        Document document = getSourceDocument();
        String label = getParameterAsString(LABEL).trim();
        document.getLink().setLabel(label);

        WorkflowUtil.invoke(this.manager, getSession(), getLogger(), document, getEvent());

    }
View Full Code Here

     */
    protected org.apache.lenya.cms.repository.Node[] getNodesToLock() throws UsecaseException {
        try {
            List nodes = new ArrayList();

            Document doc = getSourceDocument();
            if(doc != null) {
                nodes.add(doc.getRepositoryNode());
               
                // lock the authoring site to avoid having live nodes for which no corresponding
                // authoring node exists
                nodes.add(doc.area().getSite().getRepositoryNode());
               
                // lock the live site to avoid overriding changes made by others
                SiteStructure liveSite = doc.getPublication().getArea(Publication.LIVE_AREA).getSite();
                nodes.add(liveSite.getRepositoryNode());
            }

            return (org.apache.lenya.cms.repository.Node[]) nodes
                    .toArray(new org.apache.lenya.cms.repository.Node[nodes.size()]);
View Full Code Here

TOP

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

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.