Package org.apache.lenya.cms.publication

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


        String nodeId = getParameterAsString(NODE_ID);
        DocumentBuilder builder = getSourceDocument().getPublication().getDocumentBuilder();
        if (!builder.isValidDocumentName(nodeId)) {
            addErrorMessage("The document ID is not valid.");
        } else {
            DocumentLocator target = getTargetLocator();
            Publication pub = getDocumentFactory().getPublication(target.getPublicationId());
            SiteStructure site = pub.getArea(target.getArea()).getSite();
            if (site.contains(target.getPath(), target.getLanguage())) {
                addErrorMessage("The document does already exist.");
            }
        }
    }
View Full Code Here


    protected DocumentLocator getTargetLocator() throws DocumentBuildException, SiteException,
            DocumentException {
        String nodeId = getParameterAsString(NODE_ID);
        Document doc = getSourceDocument();
        DocumentLocator loc = DocumentLocator.getLocator(doc.getPublication().getId(), doc
                .getArea(), doc.getPath(), doc.getLanguage());
        DocumentLocator parent = loc.getParent();
        return parent.getChild(nodeId);
    }
View Full Code Here

    protected void doExecute() throws Exception {
        super.doExecute();

        Document targetDoc;
        Document source = getSourceDocument();
        DocumentLocator target = getTargetLocator();
        DocumentManager documentManager = null;
        try {
            documentManager = (DocumentManager) this.manager.lookup(DocumentManager.ROLE);
            documentManager.moveAll(source.area(), source.getPath(), source.area(), target
                    .getPath());
            targetDoc = getDocumentFactory().get(target);
        } finally {
            if (documentManager != null) {
                this.manager.release(documentManager);
View Full Code Here

        Document doc = envelope.getDocument();
        if (doc == null) {
            Publication pub = envelope.getPublication();
            Request request = ObjectModelHelper.getRequest(objectModel);
            String url = ServletHelper.getWebappURI(request);
            DocumentLocator loc;
            try {
                loc = pub.getDocumentBuilder().getLocator(pub.getFactory(), url);
            } catch (DocumentBuildException e) {
                throw new SiteException(e);
            }
            path = loc.getPath();
        } else {
            path = doc.getLocator().getPath();
        }
        return path;
    }
View Full Code Here

        Document sourceDoc = getSourceDocument();
        String basePath = sourceDoc != null ? sourceDoc.getPath() : "";

        String potentialPath = basePath + "/" + nodeId;

        DocumentLocator potentialLoc = DocumentLocator.getLocator(getPublication().getId(),
                targetArea, potentialPath, language);
        return SiteUtil.getAvailableLocator(this.manager, getDocumentFactory(), potentialLoc)
                .getPath();
    }
View Full Code Here

                contextUtility = (ContextUtility) serviceManager.lookup(ContextUtility.ROLE);
                Session session = RepositoryUtil.getSession(this.serviceManager, contextUtility
                        .getRequest());
                DocumentFactory map = DocumentUtil.createDocumentFactory(this.serviceManager, session);
                Publication pub = map.getPublication(pubId);
                DocumentLocator loc = pub.getDocumentBuilder().getLocator(map, webappUrl);
                url = "/" + pubId + "/" + area + loc.getPath();
            } catch (ServiceException e) {
                throw new AccessControlException("Error looking up ContextUtility component", e);
            } catch (Exception e) {
                throw new AccessControlException(e);
            } finally {
View Full Code Here

            String relation = getRelation();
            Document sourceDoc = getSourceDocument();
            if (sourceDoc == null) {
                return "/" + getNewDocumentName();
            } else {
                DocumentLocator sourceLoc = getSourceDocument().getLocator();
                if (relation.equals(RELATION_CHILD)) {
                    return sourceLoc.getChild(getNewDocumentName()).getPath();
                } else if (relation.equals(RELATION_BEFORE) || relation.equals(RELATION_AFTER)) {
                    return sourceLoc.getParent().getChild(getNewDocumentName()).getPath();
                } else {
                    throw new IllegalStateException("unsupported relation " + relation);
                }
            }
        }
View Full Code Here

    }

    public DocumentLocator[] getRequiredResources(DocumentFactory map, DocumentLocator loc)
            throws SiteException {
        List ancestors = new ArrayList();
        DocumentLocator locator = loc;
        while (locator.getParent() != null) {
            DocumentLocator parent = locator.getParent();
            ancestors.add(parent);
            locator = parent;
        }
        return (DocumentLocator[]) ancestors.toArray(new DocumentLocator[ancestors.size()]);
    }
View Full Code Here

    public DocumentLocator[] getRequiredResources(DocumentFactory map, final DocumentLocator loc)
            throws SiteException {
       
        List ancestors = new ArrayList();
        DocumentLocator locator = loc;
        while (locator.getParent() != null) {
            DocumentLocator parent = locator.getParent();
            ancestors.add(parent);
            locator = parent;
        }
        return (DocumentLocator[]) ancestors.toArray(new DocumentLocator[ancestors.size()]);
    }
View Full Code Here

            String webappUrl = ServletHelper.getWebappURI(request);
            Document document = this.identityMap.getFromURL(webappUrl);

            contextPath = request.getContextPath();

            DocumentLocator parentLocator = document.getLocator().getParent("/index");
            Document parent = this.identityMap.get(parentLocator);
            parentUrl = parent.getCanonicalWebappURL();
        } catch (final DocumentBuildException e) {
            throw new ProcessingException(e);
        }
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.