Package org.apache.lenya.cms.publication

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


    /**
     * @see org.apache.lenya.cms.usecase.AbstractUsecase#getNodesToLock()
     */
    protected Node[] getNodesToLock() throws UsecaseException {
        try {
            Document doc = getSourceDocument();
            List nodes = new ArrayList();

            NodeSet set = SiteUtil.getSubSite(this.manager, doc.getLink().getNode());
            Document[] documents = set.getDocuments();
            for (int i = 0; i < documents.length; i++) {
                nodes.add(documents[i].getRepositoryNode());
            }

View Full Code Here


        // TODO Auto-generated method stub
        return null;
    }

    protected String getNewDocumentPath() {
        Document doc = getSourceDocument();
        return doc.getUUID();
    }
View Full Code Here

    protected Node[] getNodesToLock() throws UsecaseException {
        try {
            List nodes = new ArrayList();
            DocumentSet set = new DocumentSet();

            Document doc = getSourceDocument();
            NodeSet subsite = SiteUtil.getSubSite(this.manager, doc.getLink().getNode());
            set.addAll(new DocumentSet(subsite.getDocuments()));

            Document[] documents = set.getDocuments();
            for (int i = 0; i < documents.length; i++) {
                nodes.add(documents[i].getRepositoryNode());
            }

            Area live = doc.getPublication().getArea(Publication.LIVE_AREA);
            nodes.add(live.getSite().getRepositoryNode());
            return (Node[]) nodes.toArray(new Node[nodes.size()]);

        } catch (Exception e) {
            throw new UsecaseException(e);
View Full Code Here

     */
    protected Document loadDocument(Element documentElement) throws DocumentBuildException {
        String uuid = documentElement.getAttribute(ATTRIBUTE_UUID);
        String language = documentElement.getAttribute(ATTRIBUTE_LANGUAGE);
        String path = documentElement.getAttribute(ATTRIBUTE_PATH);
        Document document = getDelegate().getFactory().get(getDelegate().getPublication(),
                getDelegate().getArea(), uuid, language);
        String key = getKey(uuid, language);
        if (!this.doc2path.containsKey(key)) {
            this.doc2path.put(key, path);
        }
View Full Code Here

    protected void doCheckPreconditions() throws Exception {
        super.doCheckPreconditions();
        if (!hasErrors()) {

            String event = getEvent();
            Document document = getSourceDocument();

            if (!document.getArea().equals(Publication.AUTHORING_AREA)) {
                addErrorMessage("This usecase can only be invoked from the authoring area.");
                return;
            }

            UsecaseWorkflowHelper.checkWorkflow(this.manager, this, event, document, getLogger());
View Full Code Here

     * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
     */
    protected void doExecute() throws Exception {
        DocumentManager documentManager = null;
        try {
            Document authoringDocument = getSourceDocument();
            if (authoringDocument.getResourceType().getName().equals("entry")) {
                updateBlogEntry(authoringDocument);
            }
            updateFeed();
            documentManager = (DocumentManager) this.manager.lookup(DocumentManager.ROLE);
            documentManager.copyToArea(authoringDocument, Publication.LIVE_AREA);
View Full Code Here

        if (!hasErrors()) {
            if (!getSourceDocument().getArea().equals(Publication.AUTHORING_AREA)) {
                addErrorMessage("This usecase can only be invoked from the authoring area.");
                return;
            }
            Document liveDocument = getSourceDocument().getAreaVersion(Publication.LIVE_AREA);
            if (liveDocument.exists()) {
                addErrorMessage("The document cannot be deleted because it's Live, deactivate it first");
                return;
            }
            String event = getEvent();
            if (!WorkflowUtil.canInvoke(this.manager,
View Full Code Here

        try {
            boolean contains = false;

            String[] languages = resource.getLanguages();
            for (int i = 0; i < languages.length; i++) {
                Document doc = resource.getTranslation(languages[i]);
                DocumentStore store = getStore(doc);
                contains = contains || store.contains(doc);
            }

            return contains;
View Full Code Here

     * @see org.apache.lenya.cms.usecase.AbstractUsecase#getNodesToLock()
     */
    protected org.apache.lenya.cms.repository.Node[] getNodesToLock() throws UsecaseException {
        try {
            List nodes = new ArrayList();
            Document doc = getSourceDocument();          
            nodes.add(doc.getRepositoryNode());           
            nodes.add(doc.area().getSite().getRepositoryNode());           
            return (org.apache.lenya.cms.repository.Node[]) nodes.toArray(new org.apache.lenya.cms.repository.Node[nodes.size()]);           
        } catch (Exception e) {
            throw new UsecaseException(e);
        }
    }
View Full Code Here

            if (!area.contains(uuid, lang)) {
                createAreaVersion(publication, areaName, uuid, lang);
            }

            Document doc = area.getDocument(uuid, lang);

            store = new DocumentStore(doc, getLogger());
        } catch (Exception e) {
            throw new RepositoryException(e);
        }
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.