Examples of DocumentManager


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

        Publication pub = getPublication();
        Document clippedDocument = clipboard.getDocument(identityMap, pub);

        final String targetPath = getTargetPath();
        final Area area = clippedDocument.area();
        DocumentManager documentManager = null;
        try {
            documentManager = (DocumentManager) this.manager.lookup(DocumentManager.ROLE);

            if (clipboard.getMethod() == Clipboard.METHOD_COPY) {
                documentManager.copyAll(area, clippedDocument.getPath(), area, targetPath);
            } else if (clipboard.getMethod() == Clipboard.METHOD_CUT) {
                documentManager.moveAll(area, clippedDocument.getPath(), area, targetPath);
            } 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

    }

    protected void testRemoved(Document doc, TestListener listener) throws Exception {
        listener.reset();

        DocumentManager docManager = null;
        try {
            docManager = (DocumentManager) getManager().lookup(DocumentManager.ROLE);
            Document target = doc.getFactory().get(doc.getPublication(), doc.getArea(), "/testTarget", doc.getLanguage());
            docManager.move(doc, target.getLocator());

            assertFalse(listener.wasRemoved());
            doc.getRepositoryNode().getSession().commit();
            Thread.currentThread().sleep(100);
            assertTrue(listener.wasRemoved());
       
            docManager.move(target, doc.getLocator());
            assertFalse(listener.wasChanged());
            doc.getRepositoryNode().getSession().commit();
            Thread.currentThread().sleep(100);
            assertTrue(listener.wasChanged());
        }
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

        SiteStructure authoringSite = authoring.getSite();
        SiteNode node = authoringSite.getNode(SOURCE_PATH);
        Document doc = node.getLink("en").getDocument();

        DocumentManager docMgr = null;
        try {
            docMgr = (DocumentManager) getManager().lookup(DocumentManager.ROLE);

            String pubId = doc.getPublication().getId();
            String area = doc.getArea();
            DocumentLocator loc = DocumentLocator.getLocator(pubId, area, PATH, doc.getLanguage());

            authoringSite.add("/foo");
            authoringSite.add("/foo/bar");

            docMgr.copy(doc, loc);

            // add an ancestor language version to test the method
            // MoveSubSite.getTargetURL()
            DocumentLocator ancestorLoc = DocumentLocator.getLocator(pubId, area, "/foo", "de");
            docMgr.copy(doc, ancestorLoc);

            SiteNode childNode = authoringSite.getNode(PATH);
            this.uuid = childNode.getUuid();
        } finally {
            if (docMgr != null) {
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;
        ServiceSelector selector = null;
        ResourceType resourceType = null;
        try {

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

            String language = getParameterAsString(LANGUAGE);
            Document initialDocument = getInitialDocument();

            Document document;

            String title = getDublinCoreParameter(DublinCore.ELEMENT_TITLE).trim();

            if (createVersion()) {
                document = documentManager.addVersion(initialDocument, getArea(), language, true);
                document.getLink().setLabel(title);
            } else {
                if (initialDocument == null) {
                    selector = (ServiceSelector) this.manager
                            .lookup(ResourceType.ROLE + "Selector");
                    resourceType = (ResourceType) selector.select(getDocumentTypeName());
                    String sampleName = getParameterAsString(SAMPLE, resourceType.getSampleNames()[0]);
                    ResourceType.Sample sample = resourceType.getSample(sampleName);
                    document = documentManager.add(getDocumentFactory(), resourceType, sample.getUri(),
                            getPublication(), getArea(), getNewDocumentPath(), language,
                            getSourceExtension(), title, getVisibleInNav());
                    document.setMimeType(sample.getMimeType());
                } else {
                    document = documentManager.add(initialDocument, getArea(),
                            getNewDocumentPath(), language, getSourceExtension(), title,
                            getVisibleInNav());
                }
            }

View Full Code Here

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

                }
            }
           
        }

        DocumentManager docManager = null;
        try {
            docManager = (DocumentManager) this.manager.lookup(DocumentManager.ROLE);
            docManager.moveAll(doc.area(), doc.getPath(), targetArea, targetLoc.getPath());

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

Examples of xbird.xquery.misc.DocumentManager

    private GregorianCalendar _currentDateTime;

    //---------------------------

    private DynamicContext() {
        this.documents = new DocumentManager();
    }
View Full Code Here

Examples of xbird.xquery.misc.DocumentManager

    public final XQExpression getQueryExpression() {
        return _queryExpr;
    }

    protected Object readResolve() throws ObjectStreamException {
        this.documents = new DocumentManager();
        this.tracSequenceStack = new Stack<Sequence<? extends Item>>();
        return this;
    }
View Full Code Here

Examples of xbird.xquery.misc.DocumentManager

                try {
                    colurl = resolved.toURL();
                } catch (MalformedURLException e) {
                    throw new DynamicError("Invalid uri: " + argStr);
                }
                DocumentManager docmgr = dynEnv.getDocumentManager();
                DTMDocument doc = docmgr.loadDocument(colurl, dynEnv);
                catalog = resolveCatalog(doc, dynEnv);
            } else if(unescapedArg.startsWith("/")) {
                DbCollection coll = DbCollection.getCollection(unescapedArg);
                if(coll == null) {
                    catalog = Collections.emptyMap();
View Full Code Here

Examples of xbird.xquery.misc.DocumentManager

                        url = new URL(urlstr);
                    } catch (MalformedURLException e) {
                        throw new IllegalStateException("/collection/document/text() value is malformed url: "
                                + urlstr);
                    }
                    DocumentManager docman = dynEnv.getDocumentManager();
                    DTMDocument doc = docman.loadDocument(url, dynEnv);
                    map.put(urlstr, doc);
                }
            }
            return map;
        } else {
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.