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;
        ServiceSelector selector = null;
        ResourceType resourceType = null;

        try {
            selector = (ServiceSelector) this.manager.lookup(ResourceType.ROLE + "Selector");
            resourceType = (ResourceType) selector.select(getDocumentTypeName());

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

            DocumentFactory map = getDocumentFactory();

            String documentId = getDocumentID();
           
            String sampleName = resourceType.getSampleNames()[0];
            String sampleUri = resourceType.getSample(sampleName).getUri();

            Document document = documentManager.add(map,
                    resourceType,
                    sampleUri,
                    getSourceDocument().getPublication(),
                    getSourceDocument().getArea(),
                    documentId,
View Full Code Here

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

            if (doc == null)
                throw new IllegalArgumentException("illegal usage, source document may not be null");

            // create new doc from PUT input
            if (!doc.exists()) {
                DocumentManager documentManager = null;
                ServiceSelector selector = null;
                ResourceType resourceType = null;
                try {
                    selector = (ServiceSelector) this.manager
                            .lookup(ResourceType.ROLE + "Selector");

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

                    DocumentFactory map = getDocumentFactory();
                    String path = doc.getPath();
                    // lookupResourceType(extension)
                    resourceType = lookUpExtension(extension, selector);
                    ResourceType.Sample sample = resourceType.getSample(resourceType.getSampleNames()[0]);
                    doc = documentManager.add(map, resourceType, sample.getUri(), getPublication(), doc
                            .getArea(), path, doc.getLanguage(), extension, doc.getName(), true);
                    doc.setMimeType(sample.getMimeType());
                    setMetaData(doc);
                } 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 {
        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);
            WorkflowUtil.invoke(this.manager, getSession(), getLogger(), authoringDocument,
                    getEvent());
        } catch (Exception e) {
            throw new RuntimeException(e);
        } finally {
View Full Code Here

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

    /**
     * Deletes a document.
     * @param document The document to delete.
     */
    protected void delete(Document document) {
        DocumentManager documentManager = null;
        boolean success = false;
        try {
            documentManager = (DocumentManager) this.manager.lookup(DocumentManager.ROLE);
            documentManager.delete(document);      
            WorkflowUtil.invoke(this.manager,
                    getSession(),
                    getLogger(),
                    document,
                    getEvent());
View Full Code Here

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

        return store;
    }

    protected void createAreaVersion(Publication publication, String areaName, String uuid,
            String lang) throws PublicationException, ServiceException {
        DocumentManager docManager = null;
        try {
            Area authoring = publication.getArea(Publication.AUTHORING_AREA);
            Document authoringDoc = authoring.getDocument(uuid, lang);
            docManager = (DocumentManager) this.manager.lookup(DocumentManager.ROLE);
            docManager.copyToArea(authoringDoc, areaName);
        } finally {
            if (docManager != null) {
                this.manager.release(docManager);
            }
        }
View Full Code Here

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

     */
    protected void deactivate(Document authoringDocument) {

        boolean success = false;

        DocumentManager documentManager = null;
        try {
            Document liveDocument = authoringDocument.getAreaVersion(Publication.LIVE_AREA);

            documentManager = (DocumentManager) this.manager.lookup(DocumentManager.ROLE);
            documentManager.delete(liveDocument);
        
            WorkflowUtil.invoke(this.manager,
                    getSession(),
                    getLogger(),
                    authoringDocument,
View Full Code Here

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

    protected void publish(Document authoringDocument) throws DocumentException, SiteException,
            PublicationException {

        createAncestorNodes(authoringDocument);

        DocumentManager documentManager = null;

        try {
            documentManager = (DocumentManager) this.manager.lookup(DocumentManager.ROLE);
            documentManager.copyToArea(authoringDocument, Publication.LIVE_AREA);

            boolean notify = Boolean.valueOf(getBooleanCheckboxParameter(SEND_NOTIFICATION))
                    .booleanValue();
            if (notify) {
                sendNotification(authoringDocument);
View Full Code Here

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

     */
    protected void deactivate(Document authoringDocument) {

        boolean success = false;

        DocumentManager documentManager = null;
        try {
            Document liveDocument = authoringDocument.getAreaVersion(Publication.LIVE_AREA);

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

            success = true;
        } catch (Exception e) {
            throw new RuntimeException(e);
        } finally {
View Full Code Here

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

        String navigationTitle = DocumentHelper.getSimpleElementText(element);

        String contentUri = baseUri + path + "/index_" + language;
        String metaUri = contentUri + ".meta";

        DocumentManager docManager = null;
        ServiceSelector selector = null;
        ResourceType resourceType = null;
        SourceResolver resolver = null;
        try {

            org.w3c.dom.Document xml = SourceUtil.readDOM(metaUri, this.manager);
            NamespaceHelper helper = new NamespaceHelper(
                    "http://apache.org/cocoon/lenya/page-envelope/1.0", "", xml);
            Element metaElement = helper.getFirstChild(xml.getDocumentElement(), "meta");
            Element internalElement = helper.getFirstChild(metaElement, "internal");
            Element resourceTypeElement = helper.getFirstChild(internalElement, "resourceType");
            String resourceTypeName = DocumentHelper.getSimpleElementText(resourceTypeElement);

            Element mimeTypeElement = helper.getFirstChild(internalElement, "mimeType");
            String mimeType = DocumentHelper.getSimpleElementText(mimeTypeElement);

            selector = (ServiceSelector) this.manager.lookup(ResourceType.ROLE + "Selector");
            resourceType = (ResourceType) selector.select(resourceTypeName);

            docManager = (DocumentManager) this.manager.lookup(DocumentManager.ROLE);
            Document newDoc;
            SiteStructure site = area.getSite();
            if (!site.contains(path) || site.getNode(path).getLanguages().length == 0) {
                newDoc = docManager.add(area.getPublication().getFactory(), resourceType,
                        contentUri, area.getPublication(), area.getName(), path, language, "xml",
                        navigationTitle, visibleInNav);
                newDoc.setMimeType(mimeType);
            } else {
                SiteNode node = site.getNode(path);
                Document doc = node.getLink(node.getLanguages()[0]).getDocument();
                newDoc = docManager.addVersion(doc, area.getName(), language, true);
                resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
                SourceUtil.copy(resolver, contentUri, newDoc.getOutputStream());
                newDoc.getLink().setLabel(navigationTitle);
            }
View Full Code Here

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

        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
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.