Package org.apache.lenya.cms.publication.util

Examples of org.apache.lenya.cms.publication.util.DocumentSet


        if (getLogger().isDebugEnabled()) {
            getLogger().debug("Publishing document [" + document + "]");
            getLogger().debug("Subtree publishing: [" + isSubtreeEnabled() + "]");
        }

        DocumentSet set = getInvolvedDocuments(document);
        try {
            set.visit(this);
        } catch (PublicationException e) {
            throw new RuntimeException(e);
        }

        if (getLogger().isDebugEnabled()) {
View Full Code Here


    /**
     * @param document The document.
     * @return All documents that are involved in this transaction.
     */
    protected DocumentSet getInvolvedDocuments(Document document) {
        DocumentSet set;

        ServiceSelector selector = null;
        SiteManager siteManager = null;
        try {
            selector = (ServiceSelector) this.manager.lookup(SiteManager.ROLE + "Selector");
            siteManager = (SiteManager) selector.select(document.getPublication()
                    .getSiteManagerHint());

            Document[] descendants = siteManager.getRequiringResources(document);
            set = new DocumentSet(descendants);
            set.add(document);
            siteManager.sortAscending(set);
        } catch (Exception e) {
            throw new RuntimeException(e);
        } finally {
            if (selector != null) {
View Full Code Here

    /**
     * @see org.apache.lenya.cms.usecase.AbstractUsecase#doCheckPreconditions()
     */
    protected void doCheckPreconditions() throws Exception {
        super.doCheckPreconditions();
        DocumentSet set = SiteUtil.getSubSite(this.manager, getSourceDocument());
        if (!WorkflowUtil.canInvoke(this.manager, getLogger(), set, getEvent())) {
            addErrorMessage("The workflow event cannot be invoked on all documents.");
        }
    }
View Full Code Here

     * @return A document set.
     * @throws SiteException if an error occurs.
     */
    public static DocumentSet getSubSite(ServiceManager manager, Document document)
            throws SiteException {
        DocumentSet set = null;
        ServiceSelector selector = null;
        SiteManager siteManager = null;
        try {
            selector = (ServiceSelector) manager.lookup(SiteManager.ROLE + "Selector");
            siteManager = (SiteManager) selector.select(document.getPublication()
                    .getSiteManagerHint());
            set = new DocumentSet(siteManager.getRequiringResources(document));

            String[] languages = document.getLanguages();
            for (int i = 0; i < languages.length; i++) {
                Document version = document.getIdentityMap().getLanguageVersion(document,
                        languages[i]);
                set.add(version);
            }

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

     * @throws SiteException if an error occurs.
     */
    public static DocumentSet getTransferedSubSite(ServiceManager manager, Document source,
            String targetArea, int mode) throws SiteException {

        DocumentSet set = new DocumentSet();
        ServiceSelector selector = null;
        SiteManager siteManager = null;
        try {
            selector = (ServiceSelector) manager.lookup(SiteManager.ROLE + "Selector");
            siteManager = (SiteManager) selector.select(source.getPublication()
                    .getSiteManagerHint());

            DocumentSet subSite = SiteUtil.getSubSite(manager, source);
            Document[] docs = subSite.getDocuments();
            for (int i = 0; i < docs.length; i++) {
                Document target = SiteUtil.getTarget(siteManager, docs[i], targetArea, mode);
                if (target != null) {
                    set.add(target);
                }
View Full Code Here

       
        DocumentManager documentManager = null;
        try {
            documentManager = (DocumentManager) this.manager.lookup(DocumentManager.ROLE);
            Document[] documents = getTrashDocuments();
            DocumentSet set = new DocumentSet(documents);
            documentManager.delete(set);
        }
        finally {
            if (documentManager != null) {
                this.manager.release(documentManager);
View Full Code Here

            String clippedId = clippedDocument.getId();
            String clippedBase = clippedId.substring(0, clippedId.length() - clippedName.length());

            String targetBase = getSourceDocument().getId() + "/";

            DocumentSet subsite = SiteUtil.getSubSite(this.manager, clippedDocument);
            Document[] subsiteDocs = subsite.getDocuments();
            for (int i = 0; i < subsiteDocs.length; i++) {
                if (clipboard.getMethod() == Clipboard.METHOD_CUT) {
                    nodes.addAll(Arrays.asList(subsiteDocs[i].getRepositoryNodes()));
                }
                String id = subsiteDocs[i].getId().substring(clippedBase.length());
View Full Code Here

        if (getLogger().isDebugEnabled()) {
            getLogger().debug("Obtaining requiring resources of [" + resource + "]");
        }

        DocumentSet resources = new DocumentSet();
        SiteTree tree = getTree(resource);

        SiteTreeNode node = tree.getNode(resource.getId());
        if (node != null) {
            List preOrder = node.preOrder();

            // remove original resource (does not require itself)
            preOrder.remove(0);

            try {
                for (int i = 0; i < preOrder.size(); i++) {
                    SiteTreeNode descendant = (SiteTreeNode) preOrder.get(i);
                    Label[] labels = descendant.getLabels();
                    for (int j = 0; j < labels.length; j++) {
                        Document version = resource.getIdentityMap().get(resource.getPublication(),
                                resource.getArea(),
                                descendant.getAbsoluteId(),
                                labels[j].getLanguage());
                        resources.add(version);
                        if (getLogger().isDebugEnabled()) {
                            getLogger().debug("    Descendant: [" + version + "]");
                        }
                    }
                }
            } catch (PublicationException e) {
                throw new SiteException(e);
            }

            if (getLogger().isDebugEnabled()) {
                getLogger().debug("Obtaining requiring resources completed.");
            }
        }

        return resources.getDocuments();
    }
View Full Code Here

            selector = (ServiceSelector) this.manager.lookup(SiteManager.ROLE + "Selector");
            siteManager = (SiteManager) selector.select(source.getPublication()
                    .getSiteManagerHint());

            Document[] descendantsArray = siteManager.getRequiringResources(source);
            DocumentSet descendants = new DocumentSet(descendantsArray);
            descendants.add(source);
            siteManager.sortAscending(descendants);

            DocumentVisitor visitor = new CopyVisitor(this, source, target);
            descendants.visit(visitor);
        } catch (ServiceException e) {
            throw new PublicationException(e);
        } finally {
            if (selector != null) {
                if (siteManager != null) {
View Full Code Here

            selector = (ServiceSelector) this.manager.lookup(SiteManager.ROLE + "Selector");
            siteManager = (SiteManager) selector.select(document.getPublication()
                    .getSiteManagerHint());

            Document[] descendantsArray = siteManager.getRequiringResources(document);
            DocumentSet descendants = new DocumentSet(descendantsArray);
            descendants.add(document);
            delete(descendants);
        } catch (ServiceException e) {
            throw new PublicationException(e);
        } finally {
            if (selector != null) {
View Full Code Here

TOP

Related Classes of org.apache.lenya.cms.publication.util.DocumentSet

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.