Examples of DocumentManager


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

        // create new document
        // implementation note: since blog does not have a hierarchy,
        // document id (full path) and document id-name (this leaf's id)
        // are the same
        DocumentManager documentManager = null;
        DocumentTypeBuilder documentTypeBuilder = null;
        try {
            documentTypeBuilder = (DocumentTypeBuilder) this.manager
                    .lookup(DocumentTypeBuilder.ROLE);

            DocumentType documentType = documentTypeBuilder
                    .buildDocumentType(getDocumentTypeName(), getSourceDocument().getPublication());

            documentManager = (DocumentManager) this.manager.lookup(DocumentManager.ROLE);

            DocumentIdentityMap map = (DocumentIdentityMap) getUnitOfWork().getIdentityMap();

            String documentId = getDocumentID();
            Document document = map.get(getSourceDocument().getPublication(), getSourceDocument()
                    .getArea(), documentId, language);

            documentManager.add(document,
                    documentType,
                    getParameterAsString(DublinCore.ELEMENT_TITLE),
                    allParameters);
        } finally {
            if (documentManager != null) {
View Full Code Here

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

     * Publishes a document.
     * @param authoringDocument The authoring document.
     */
    protected void publish(Document authoringDocument) {

        DocumentManager documentManager = null;
        try {
            documentManager = (DocumentManager) this.manager.lookup(DocumentManager.ROLE);
            documentManager.copyToArea(authoringDocument, Publication.LIVE_AREA);
            WorkflowUtil.invoke(this.manager, getLogger(), authoringDocument, getEvent());
        } catch (Exception e) {
            throw new RuntimeException(e);
        } finally {
            if (documentManager != null) {
View Full Code Here

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

     * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
     */
    protected void doExecute() throws Exception {
        super.doExecute();
       
        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

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

        if (!Arrays.asList(getSupportedRelations()).contains(relation)) {
            addErrorMessage("The relation '" + relation + "' is not supported.");
        }

        DocumentManager documentManager = null;
        try {
            documentManager = (DocumentManager) this.manager.lookup(DocumentManager.ROLE);
            Document parent = getSourceDocument();
            Publication publication = getSourceDocument().getPublication();
            Document document = getSourceDocument().getIdentityMap().get(publication,
View Full Code Here

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

        DocumentIdentityMap identityMap = getDocumentIdentityMap();
        Clipboard clipboard = new ClipboardHelper().getClipboard(getContext());
        Document clippedDocument = clipboard.getDocument(identityMap);

        Document targetDocument = getTargetDocument();
        DocumentManager documentManager = null;
        try {
            documentManager = (DocumentManager) this.manager.lookup(DocumentManager.ROLE);

            if (clipboard.getMethod() == Clipboard.METHOD_COPY) {
                documentManager.copyAll(clippedDocument, targetDocument);
            } else if (clipboard.getMethod() == Clipboard.METHOD_CUT) {
                documentManager.moveAll(clippedDocument, targetDocument);
            } else {
                throw new RuntimeException("This clipboard method is not supported!");
            }
        } finally {
            if (documentManager != null) {
View Full Code Here

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

        super.doCheckExecutionConditions();

        DocumentIdentityMap identityMap = getSourceDocument().getIdentityMap();

        String nodeId = getParameterAsString(NODE_ID);
        DocumentManager documentManager = null;
        try {
            documentManager = (DocumentManager) this.manager.lookup(DocumentManager.ROLE);
            if (!documentManager.isValidDocumentName(nodeId)) {
                addErrorMessage("The document ID is not valid.");
            } else {
                Document parent = identityMap.getParent(getSourceDocument());
                Publication publication = getSourceDocument().getPublication();
                Document document = identityMap.get(publication,
View Full Code Here

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

        DocumentIdentityMap identityMap = document.getIdentityMap();
        String newDocumentId = getNewDocumentId();

        String[] availableLanguages = document.getLanguages();

        DocumentManager documentManager = null;
        try {
            documentManager = (DocumentManager) this.manager.lookup(DocumentManager.ROLE);
            for (int i = 0; i < availableLanguages.length; i++) {
                Document languageVersion = identityMap.get(document.getPublication(), document
                        .getArea(), document.getId(), availableLanguages[i]);

                Document newLanguageVersion = identityMap.get(document.getPublication(), document
                        .getArea(), newDocumentId, availableLanguages[i]);

                Transactionable[] nodes = newLanguageVersion.getRepositoryNodes();
                for (int j = 0; j < nodes.length; j++) {
                    nodes[j].lock();
                }
                documentManager.move(languageVersion, newLanguageVersion);

                if (availableLanguages[i].equals(document.getLanguage())) {
                    newDocument = newLanguageVersion;
                }
            }
View Full Code Here

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

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

        // create new document
        DocumentManager documentManager = null;
        DocumentTypeBuilder documentTypeBuilder = null;
        try {

            documentTypeBuilder = (DocumentTypeBuilder) this.manager
                    .lookup(DocumentTypeBuilder.ROLE);

            documentManager = (DocumentManager) this.manager.lookup(DocumentManager.ROLE);

            DocumentIdentityMap map = (DocumentIdentityMap) getUnitOfWork().getIdentityMap();
            Document document = map.get(getPublication(),
                    getArea(),
                    getNewDocumentId(),
                    getParameterAsString(LANGUAGE));

            Document initialDocument = getInitialDocument();
            if (initialDocument == null) {
                DocumentType documentType = documentTypeBuilder
                        .buildDocumentType(getDocumentTypeName(), getPublication());
                documentManager.add(document,
                        documentType,
                        getParameterAsString(DublinCore.ELEMENT_TITLE),
                        null);
            } else {
                documentManager.add(document,
                        initialDocument,
                        getParameterAsString(DublinCore.ELEMENT_TITLE),
                        null);
            }

View Full Code Here

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

        DocumentSet sources = SiteUtil.getSubSite(this.manager, doc);

        Document target = doc.getIdentityMap().getAreaVersion(doc, getTargetArea());
        target = SiteUtil.getAvailableDocument(this.manager, target);

        DocumentManager documentManager = null;
        try {
            WorkflowUtil.invoke(this.manager, getLogger(), sources, getEvent(), true);

            documentManager = (DocumentManager) this.manager.lookup(DocumentManager.ROLE);
            DocumentSet targets = SiteUtil.getTransferedSubSite(this.manager,
                    doc,
                    getTargetArea(),
                    SiteUtil.MODE_CHANGE_ID);
            documentManager.move(sources, targets);

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

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

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

        Document document = getSourceDocument();
        DocumentManager documentManager = null;
        try {
            documentManager = (DocumentManager) this.manager.lookup(DocumentManager.ROLE);
            documentManager.delete(document);
        } finally {
            if (documentManager != null) {
                this.manager.release(documentManager);
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.