Package org.apache.lenya.cms.publication

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


        Object value = null;
        WorkflowManager wfManager = null;

        try {
            PageEnvelope envelope = getEnvelope(objectModel, name);
            Document document = envelope.getDocument();
            if (document != null) {
                wfManager = (WorkflowManager) this.manager.lookup(WorkflowManager.ROLE);
                DocumentWorkflowable workflowable = new DocumentWorkflowable(document,
                        getLogger());
                if (wfManager.hasWorkflow(workflowable)) {
View Full Code Here


     * @return a <code>PageEnvelope</code>
     * @throws ConfigurationException if the page envelope could not be instantiated.
     */
    protected PageEnvelope getEnvelope(Map objectModel, String name) throws ConfigurationException {

        PageEnvelope envelope = null;
        String webappUrl = null;
        Request request = ObjectModelHelper.getRequest(objectModel);

        String[] snippets = name.split(":");
        if (snippets.length > 1) {
View Full Code Here

        if (!Arrays.asList(PageEnvelope.PARAMETER_NAMES).contains(name)) {
            throw new ConfigurationException("The attribute [" + name + "] is not supported!");
        }

        PageEnvelope envelope = getEnvelope(objectModel, attributeName);
        Object value = null;

        try {
            if (name.equals(PageEnvelope.AREA)) {
                value = envelope.getArea();
            } else if (name.equals(PageEnvelope.CONTEXT)) {
                value = envelope.getContext();
            } else if (name.equals(PageEnvelope.PUBLICATION_ID)) {
                value = envelope.getPublication().getId();
            } else if (name.equals(PageEnvelope.PUBLICATION)) {
                value = envelope.getPublication();
            } else if (name.equals(PageEnvelope.PUBLICATION_LANGUAGES_CSV)) {
                value = StringUtils.join(envelope.getPublication().getLanguages(), ',');
            } else if (name.equals(PageEnvelope.DEFAULT_LANGUAGE)) {
                value = envelope.getPublication().getDefaultLanguage();
            } else if (name.equals(PageEnvelope.BREADCRUMB_PREFIX)) {
                value = envelope.getPublication().getBreadcrumbPrefix();
            }

            Document document = envelope.getDocument();
            if (document != null) {
                if (name.equals(PageEnvelope.DOCUMENT)) {
                    value = document;
                } else if (name.equals(PageEnvelope.DOCUMENT_ID)) {
                    value = document.getId();
                } else if (name.equals(PageEnvelope.DOCUMENT_NAME)) {
                    value = document.getName();
                } else if (name.equals(PageEnvelope.DOCUMENT_LABEL)) {
                    value = document.getLabel();
                } else if (name.equals(PageEnvelope.DOCUMENT_URL)) {
                    value = document.getCanonicalDocumentURL();
                } else if (name.equals(PageEnvelope.DOCUMENT_URL_WITHOUT_LANGUAGE)) {
                    value = document.getCanonicalWebappURL();
                } else if (name.equals(PageEnvelope.DOCUMENT_PATH)) {
                    value = envelope.getDocumentPath();
                } else if (name.equals(PageEnvelope.DOCUMENT_FILE)) {
                    value = document.getFile();
                } else if (name.equals(PageEnvelope.DOCUMENT_EXTENSION)) {
                    value = document.getExtension();
                } else if (name.equals(PageEnvelope.DOCUMENT_LANGUAGE)) {
View Full Code Here

        if (!Arrays.asList(PageEnvelope.PARAMETER_NAMES).contains(name)) {
            throw new ConfigurationException("The attribute [" + name + "] is not supported!");
        }

        PageEnvelope envelope = getEnvelope(objectModel, attributeName);
        Object value = null;

        try {
            if (name.equals(PageEnvelope.AREA)) {
                value = envelope.getArea();
            } else if (name.equals(PageEnvelope.CONTEXT)) {
                value = envelope.getContext();
            } else if (name.equals(PageEnvelope.IS_PUBLICATION)) {
                value = Boolean.toString(envelope.getPublication() != null);
            } else if (name.equals(PageEnvelope.PUBLICATION_ID)) {
                Publication pub = envelope.getPublication();
                value = pub != null ? pub.getId() : "";
            } else if (name.equals(PageEnvelope.PUBLICATION)) {
                value = envelope.getPublication();
            } else if (name.equals(PageEnvelope.PUBLICATION_LANGUAGES_CSV)) {
                value = StringUtils.join(envelope.getPublication().getLanguages(), ',');
            } else if (name.equals(PageEnvelope.DEFAULT_LANGUAGE)) {
                value = envelope.getPublication().getDefaultLanguage();
            } else if (name.equals(PageEnvelope.LANGUAGE)) {
                value = envelope.getLanguage();
            } else if (name.equals(PageEnvelope.BREADCRUMB_PREFIX)) {
                value = envelope.getPublication().getBreadcrumbPrefix();
            } else if (name.equals(PageEnvelope.DOCUMENT_PATH)) {
                value = getPath(envelope, objectModel);
            } else {
                Document document = envelope.getDocument();
                if (document != null) {
                    if (name.equals(PageEnvelope.DOCUMENT)) {
                        value = document;
                    } else if (name.equals(PageEnvelope.DOCUMENT_ID)) {
                        getLogger().warn(
View Full Code Here

     * @see org.apache.lenya.cms.cocoon.flow.FlowHelper#reservedCheckIn(org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon,
     *      boolean)
     */
    public void reservedCheckIn(FOM_Cocoon cocoon, boolean backup)
            throws FileReservedCheckInException, Exception {
        final PageEnvelope pageEnvelope = getPageEnvelope(cocoon);
        Node node = pageEnvelope.getDocument().getRepositoryNode();
        node.checkin();
    }
View Full Code Here

    protected PageEnvelope getEnvelope(Map objectModel, String name) throws ConfigurationException {

        String webappUrl = null;
        Request request = ObjectModelHelper.getRequest(objectModel);

        PageEnvelope envelope = (PageEnvelope) request.getAttribute(PageEnvelope.class.getName());
        if (envelope == null) {

            String[] snippets = name.split(":");
            if (snippets.length > 1) {
                webappUrl = snippets[1];
View Full Code Here

        Object value = null;
        ServiceSelector selector = null;
        TreeSiteManager _manager = null;

        try {
            PageEnvelope envelope = getEnvelope(objectModel, name);
            Publication publication = envelope.getPublication();
           
            selector = (ServiceSelector) this.manager.lookup(SiteManager.ROLE + "Selector");
            _manager = (TreeSiteManager) selector.select(publication.getSiteManagerHint());
           
            Request request = ObjectModelHelper.getRequest(objectModel);
            Session session = RepositoryUtil.getSession(this.manager, request);
            DocumentFactory map = DocumentUtil.createDocumentFactory(this.manager, session);

            if (name.equals(AUTHORING_NODE)) {
                SiteTree authoringTree = _manager.getTree(map,
                        publication,
                        Publication.AUTHORING_AREA);
                value = authoringTree.getNode(envelope.getDocument().getPath());
            }

            if (name.equals(LIVE_NODE)) {
                SiteTree liveTree = _manager.getTree(map, publication, Publication.LIVE_AREA);
                value = liveTree.getNode(envelope.getDocument().getPath());
            }

            if (name.equals(TRASH_NODE)) {
                SiteTree trashTree = _manager.getTree(map, publication, Publication.TRASH_AREA);
                value = trashTree.getNode(envelope.getDocument().getPath());
            }

            if (name.equals(ARCHIVE_NODE)) {
                SiteTree archiveTree = _manager.getTree(map, publication, Publication.ARCHIVE_AREA);
                value = archiveTree.getNode(envelope.getDocument().getPath());
            }
        } catch (Exception e) {
            throw new ConfigurationException("Obtaining value for [" + name + "] failed: ", e);
        }
        finally {
View Full Code Here

    public void setup(SourceResolver resolver, Map objectModel, String source, Parameters parameters)
            throws ProcessingException, SAXException, IOException {
        super.setup(resolver, objectModel, source, parameters);

        try {
            PageEnvelope envelope = PageEnvelopeFactory.getInstance().getPageEnvelope(objectModel);
            this.currentDocument = envelope.getDocument();

        } catch (Exception e) {
            throw new ProcessingException(e);
        }
View Full Code Here

        final String documentId = attributes[1];
        final String language = attributes[2];

        String value = null;
        try {
            PageEnvelope envelope = PageEnvelopeFactory.getInstance().getPageEnvelope(objectModel);
            Publication publication = envelope.getPublication();

            DocumentBuilder builder = publication.getDocumentBuilder();

            // Create canonical URL
            String canonicalUrl = builder
View Full Code Here

        Map objectModel,
        String source,
        Parameters parameters)
        throws PageEnvelopeException, DocumentDoesNotExistException, DocumentException {

        PageEnvelope pageEnvelope =
            PageEnvelopeFactory.getInstance().getPageEnvelope(objectModel);

        Document doc = pageEnvelope.getDocument();
        String language = doc.getLanguage();

        if (!doc.existsInAnyLanguage()) {
            throw new DocumentDoesNotExistException("Document " + doc.getId() + " does not exist");
        }
View Full Code Here

TOP

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

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.