Examples of DocumentManager


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

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

            if (!doc.exists()) {
                DocumentManager documentManager = null;
                ServiceSelector selector = null;
                try {
                    selector = (ServiceSelector) this.manager
                            .lookup(ResourceType.ROLE + "Selector");

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

                    DocumentFactory map = getDocumentFactory();
                    String path = doc.getPath();

                    resourceType = (ResourceType) selector.select(TYPE);
                    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 {
View Full Code Here

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

        Document sourceDoc = sourceNode.getLink(sourceNode.getLanguages()[0]).getDocument();
        Document destDoc = destNode.getLink(destNode.getLanguages()[0]).getDocument();

        sourceDoc.getRepositoryNode().lock();

        DocumentManager docMgr = null;
        try {
            docMgr = (DocumentManager) getManager().lookup(DocumentManager.ROLE);
            docMgr.copy(sourceDoc, destDoc.getLocator());
        } finally {
            if (docMgr != null) {
                getManager().release(docMgr);
            }
        }
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

    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(PARAM_SEND_NOTIFICATION))
                    .booleanValue();
            if (notify) {
                sendNotification(authoringDocument);
View Full Code Here

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

    protected Document createCollectionDocument(Publication pub) throws ServiceException,
            DocumentBuildException, PublicationException {
        ServiceSelector typeSelector = null;
        ResourceType type = null;
        DocumentManager docMgr = null;
        Document doc;
        try {
            typeSelector = (ServiceSelector) getManager().lookup(ResourceType.ROLE + "Selector");
            type = (ResourceType) typeSelector.select("collection");
            docMgr = (DocumentManager) getManager().lookup(DocumentManager.ROLE);
            ResourceType.Sample sample = type.getSample(type.getSampleNames()[0]);
            doc = docMgr.add(getFactory(), type, sample.getUri(), pub, "authoring", "en", "xml");
            doc.setMimeType(sample.getMimeType());
           
        } finally {
            if (docMgr != null) {
                getManager().release(docMgr);
View Full Code Here

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

     * @throws Exception
     */
    public void testCheckIn() throws Exception {
        login("lenya");

        DocumentManager docMgr = null;
        try {
            docMgr = (DocumentManager) getManager().lookup(DocumentManager.ROLE);
            Document source = getPublication("test").getArea("authoring").getSite().getNode(
                    "/links").getLink("en").getDocument();
            Document target = docMgr.addVersion(source, "authoring", "es");
            target.delete();
        } finally {
            if (docMgr != null) {
                getManager().release(docMgr);
            }
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

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

     */
    protected void deactivate(Document authoringDocument) {

        boolean success = false;

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

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

            WorkflowUtil.invoke(this.manager, getLogger(), authoringDocument, getEvent());
            success = true;
        } catch (Exception e) {
            throw new RuntimeException(e);
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.