Package org.apache.lenya.cms.publication

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


        System.out.println("Backup was deleted: " + firstRcbakFile.getAbsolutePath());

        //TODO evaluation of meta, workflow

        Publication pub = PublicationHelper.getPublication();
        DocumentIdentityMap map = new DocumentIdentityMap(pub);
        TreeSiteManager manager = (TreeSiteManager) pub.getSiteManager(map);
        SiteTree sitetree = manager.getTree(Publication.AUTHORING_AREA);
        SiteTreeNode node = sitetree.getNode(secdocumentid);
        assertNotNull(node);
        System.out.println("Sitetree node with id " + node.getId()
View Full Code Here


        assertFalse(liveDocumentFile.exists());

        //TODO evaluation of resources, meta, workflow

        Publication pub = PublicationHelper.getPublication();
        DocumentIdentityMap map = new DocumentIdentityMap(pub);
        TreeSiteManager manager = (TreeSiteManager) pub.getSiteManager(map);
        SiteTree authoringSitetree = manager.getTree(Publication.AUTHORING_AREA);
        SiteTreeNode node = authoringSitetree.getNode(DOCUMENT_ID);
        assertNotNull(node);
        System.out.println("Sitetree node with id [" + node.getId() + "] is always in authoring");
View Full Code Here

        File documentFile = new File(authoringDirectory, filepath);
        assertTrue(documentFile.exists());
        System.out.println("Document was copied: " + documentFile.getAbsolutePath());

        Publication pub = PublicationHelper.getPublication();
        DocumentIdentityMap map = new DocumentIdentityMap(pub);
        TreeSiteManager manager = (TreeSiteManager) pub.getSiteManager(map);

        SiteTree sitetree = manager.getTree(Publication.AUTHORING_AREA);
        SiteTreeNode node = sitetree.getNode(secdocumentid);
        assertNotNull(node);
View Full Code Here

            } else if (action.equals(DELETE)) {
                String jobId = getJobId(schedulerParameters);
                getScheduler().deleteJob(jobId, publicationId);
            } else if (action.equals(DOCUMENT_DELETED)) {
                String documentUrl = (String) schedulerParameters.get(PARAMETER_DOCUMENT_URL);
                DocumentIdentityMap map = new DocumentIdentityMap(null, null);
                org.apache.lenya.cms.publication.Document document = map.getFromURL(documentUrl);
                deleteDocumentJobs(document);
            }

            // handle the remainder of the request by simply returning all
            // scheduled jobs (for the given publication ID).
View Full Code Here

            }
            this.getLogger().debug("Parameter areas: " + areasStr);
        }

        try {
            this.identityMap = new DocumentIdentityMap(this.manager, getLogger());
            envelope = PageEnvelopeFactory.getInstance().getPageEnvelope(this.identityMap,
                    _objectModel);
        } catch (final PageEnvelopeException e) {
            throw new ProcessingException("Resolving page envelope failed: ", e);
        }
View Full Code Here

            PublicationFactory factory = PublicationFactory.getInstance(new ConsoleLogger());
            this.publication = factory.getPublication(_objectModel);
        } catch (PublicationException e) {
            throw new RuntimeException(e);
        }
        this.identityMap = new DocumentIdentityMap(manager, new ConsoleLogger());
    }
View Full Code Here

            if (!path.startsWith("//")) {

                Map objectModel = ContextHelper.getObjectModel(this.context);
                try {
                    DocumentIdentityMap map = new DocumentIdentityMap(this.manager, getLogger());
                    PageEnvelopeFactory pageEnvelopeFactory = PageEnvelopeFactory.getInstance();

                    if (pageEnvelopeFactory != null) {
                        PageEnvelope pageEnvelope = pageEnvelopeFactory.getPageEnvelope(map,
                                objectModel);

                        if (pageEnvelope != null) {
                            String publicationID = pageEnvelope.getPublication().getId();
                            String area = pageEnvelope.getDocument().getArea();
                            path = "/" + publicationID + "/" + Publication.CONTENT_PATH + "/"
                                    + area + path;
                        }
                    }
                } catch (final PageEnvelopeException e1) {
                    throw new SourceException(
                            "Cannot attach publication-id and/or area to " + path, e1);
                }
            }

            while (path.startsWith("/")) {
                path = path.substring(1);
            }

            IdentityMap map = null;

            Request request = ContextHelper.getRequest(this.context);
            UnitOfWork unit = (UnitOfWork) request.getAttribute(UnitOfWork.class.getName());
            if (unit != null) {
                map = unit.getIdentityMap();
            } else {
                map = new DocumentIdentityMap(this.manager, getLogger());
            }

            if (getLogger().isDebugEnabled()) {
                getLogger().debug("Creating repository source for URI [" + location + "]");
            }
View Full Code Here

            Publication publication = envelope.getPublication();
           
            selector = (ServiceSelector) this.manager.lookup(SiteManager.ROLE + "Selector");
            _manager = (TreeSiteManager) selector.select(publication.getSiteManagerHint());
           
            DocumentIdentityMap map = new DocumentIdentityMap(this.manager, getLogger());

            if (name.equals(AUTHORING_NODE)) {
                SiteTree authoringTree = _manager.getTree(map,
                        publication,
                        Publication.AUTHORING_AREA);
View Full Code Here

        }

        PageEnvelope envelope = null;
        PublicationFactory factory = PublicationFactory.getInstance(getLogger());
        Publication publication = factory.getPublication(objectModel);
        DocumentIdentityMap map = new DocumentIdentityMap(this.manager, getLogger());
        Document document = null;

        try {
            envelope = PageEnvelopeFactory.getInstance().getPageEnvelope(map, objectModel);
            publication = envelope.getPublication();
            document = envelope.getDocument();
        } catch (Exception e) {
            getLogger().error("Resolving page envelope failed: ", e);
            throw e;
        }

        //get Parameters for RC
        String publicationPath = publication.getDirectory().getCanonicalPath();
        RCEnvironment rcEnvironment = RCEnvironment.getInstance(publication.getServletContext()
                .getCanonicalPath());
        this.rcmlDirectory = rcEnvironment.getRCMLDirectory();
        this.rcmlDirectory = publicationPath + File.separator + this.rcmlDirectory;
        this.backupDirectory = rcEnvironment.getBackupDirectory();
        this.backupDirectory = publicationPath + File.separator + this.backupDirectory;

        // Initialize Revision Controller
        this.rc = new RevisionController(this.rcmlDirectory, this.backupDirectory, publicationPath);
        getLogger().debug("revision controller" + this.rc);

        // /Initialize Revision Controller
        // Get session
        Session session = request.getSession(false);

        if (session == null) {
            getLogger().error(".act(): No session object");

            return null;
        }

        Identity identity = (Identity) session.getAttribute(Identity.class.getName());
        getLogger().debug(".act(): Identity: " + identity);

        //FIXME: hack because of the uri for the editor bitflux. The filename
        // cannot be get from
        // the page-envelope

        String documentid = document.getId();
        int bx = documentid.lastIndexOf("-bxe");

        if (bx > 0) {
            String language = document.getLanguage();

            int l = documentid.length();
            int bxLength = "-bxe".length();
            int lang = documentid.lastIndexOf("_", bx);
            int langLength = bx - lang;

            if (bx > 0 && bx + bxLength <= l) {
                documentid = documentid.substring(0, bx) + documentid.substring(bx + bxLength, l);

                if (lang > 0 && langLength + lang < l) {
                    language = documentid.substring(lang + 1, lang + langLength);
                    documentid = documentid.substring(0, lang)
                            + documentid.substring(lang + langLength, l - bxLength);
                }
            }

            Document srcDoc = map.get(publication, document.getArea(), documentid, language);
            File newFile = srcDoc.getFile();
            this.filename = newFile.getCanonicalPath();

        } else {
            this.filename = document.getFile().getCanonicalPath();
View Full Code Here

            getLogger().debug("    Event:       [" + eventName + "]");
        }

        PublicationFactory pubFactory = PublicationFactory.getInstance(getLogger());
        Publication pub = pubFactory.getPublication(objectModel);
        DocumentIdentityMap map = new DocumentIdentityMap(this.manager, getLogger());
        Document document = map.get(pub, area, documentId, language);

        if (getLogger().isDebugEnabled()) {
            getLogger().debug("    Invoking workflow event");
        }
        WorkflowUtil.invoke(this.manager, getLogger(), document, eventName);
View Full Code Here

TOP

Related Classes of org.apache.lenya.cms.publication.DocumentIdentityMap

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.