Package org.apache.lenya.cms.publication

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


     */
    public String[] getLanguages() throws ProcessingException {
        List availableLanguages = new ArrayList();

        try {
            DocumentLocator locator = getLocator();
            String[] languages = pub.getLanguages();
            for (int i = 0; i < languages.length; i++) {
                DocumentLocator version = locator.getLanguageVersion(languages[i]);
                Publication pub = factory.getPublication(locator.getPublicationId());
                if (pub.getArea(version.getArea()).getSite().contains(version.getPath(), version.getLanguage())) {
                    availableLanguages.add(languages[i]);
                }
            }

        } catch (Exception e) {
View Full Code Here


     * @throws ProcessingException if the document for the given language could not be created.
     */
    protected Document getDocument(String language) throws ProcessingException {
        Document document;
        try {
            DocumentLocator locator = getLocator();
            DocumentLocator version = locator.getLanguageVersion(language);
            document = this.factory.get(version);
        } catch (Exception e) {
            throw new ProcessingException(e);
        }
        return document;
View Full Code Here

        }
        return document;
    }

    protected DocumentLocator getLocator() throws DocumentBuildException {
        DocumentLocator locator = this.pub.getDocumentBuilder().getLocator(this.factory, this.url);
        return locator;
    }
View Full Code Here

        try {
            docMgr = (DocumentManager) getManager().lookup(DocumentManager.ROLE);

            String pubId = doc.getPublication().getId();
            String area = doc.getArea();
            DocumentLocator loc = DocumentLocator.getLocator(pubId, area, PATH, doc.getLanguage());

            authoringSite.add("/foo");
            authoringSite.add("/foo/bar");

            docMgr.copy(doc, loc);

            // add an ancestor language version to test the method
            // MoveSubSite.getTargetURL()
            DocumentLocator ancestorLoc = DocumentLocator.getLocator(pubId, area, "/foo", "de");
            docMgr.copy(doc, ancestorLoc);

            SiteNode childNode = authoringSite.getNode(PATH);
            this.uuid = childNode.getUuid();
        } finally {
View Full Code Here

        if(doc == null) {
            return;
        }
        // Check to see if parent node exists in target to prevent ghost nodes
        Area targetArea = doc.getPublication().getArea(targetAreaName);
        DocumentLocator targetLoc = doc.getLocator().getAreaVersion(targetAreaName);
        targetLoc = SiteUtil.getAvailableLocator(this.manager, getDocumentFactory(), targetLoc);
        String targetPath = targetLoc.getPath();
        targetPath = targetPath.substring(0,targetPath.lastIndexOf('/'));
        if(!targetArea.getSite().contains(targetPath)) {
            addErrorMessage("The authoring path [" + targetPath + "] does not exist.");
        }
    }
View Full Code Here

        Document doc = getSourceDocument();
        Document[] sources = SiteUtil.getSubSite(this.manager, doc.getLink().getNode())
                .getDocuments();
        Area targetArea = doc.getPublication().getArea(targetAreaName);

        DocumentLocator targetLoc = doc.getLocator().getAreaVersion(targetAreaName);
        targetLoc = SiteUtil.getAvailableLocator(this.manager, getDocumentFactory(), targetLoc);

        for (int i = 0; i < sources.length; i++) {
            WorkflowUtil.invoke(this.manager, getSession(), getLogger(), sources[i], getEvent(),
                    true);
           
            if (this.getClass().getName().equals(Restore.class.getName())) {
                Workflowable workflowable = WorkflowUtil.getWorkflowable(this.manager, getSession(),
                        getLogger(), sources[i]);
                String state = workflowable.getLatestVersion().getState();
                if (!state.equals("authoring")) {
                    addErrorMessage("The state is [" + state + "] instead of [authoring]!");
                }
            }
           
        }

        DocumentManager docManager = null;
        try {
            docManager = (DocumentManager) this.manager.lookup(DocumentManager.ROLE);
            docManager.moveAll(doc.area(), doc.getPath(), targetArea, targetLoc.getPath());

        } finally {
            if (docManager != null) {
                this.manager.release(docManager);
            }
View Full Code Here

TOP

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

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.