Package org.apache.lenya.cms.publication

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


        ContextUtility contextUtility = null;
        try {
            contextUtility = (ContextUtility) serviceManager.lookup(ContextUtility.ROLE);
            Session session = RepositoryUtil.getSession(this.serviceManager, contextUtility
                    .getRequest());
            DocumentFactory map = DocumentUtil.createDocumentFactory(this.serviceManager, session);

            // always check for authoring URL since the live document doesn't
            // have to exist

            URLInformation info = new URLInformation(webappUrl);
            // Danger, Will Robinson! If area or pubId is null, webappUrl.substring()
            // will be out of bounds, because null becomes "null" in string concatenation
            String pubId = info.getPublicationId();
            String area = info.getArea();
            String prefix = "/" + ((pubId != null) ? pubId + "/" : "");
            // String prefix = "/" + pubId + "/";
            String prefixWithArea = prefix + ((area != null) ? area : "");
            // String prefixWithArea = prefix + area;
            String authoringUrl = prefix + Publication.AUTHORING_AREA
                    + ((webappUrl.length()>prefixWithArea.length())?webappUrl.substring(prefixWithArea.length()):"/");

            if (map.isDocument(authoringUrl)) {
                Document authoringDoc = map.getFromURL(authoringUrl);
                url = "/" + authoringDoc.getPublication().getId() + "/" + area
                        + authoringDoc.getPath();
                if (getLogger().isDebugEnabled()) {
                    getLogger().debug("    Document exists");
                    getLogger().debug("    Document path: [" + authoringDoc.getPath() + "]");
View Full Code Here


        ContextUtility util = null;
        try {
            util = (ContextUtility) this.serviceManager.lookup(ContextUtility.ROLE);
            Request request = util.getRequest();
            DocumentFactory factory = DocumentUtil.getDocumentFactory(this.serviceManager, request);
            return PublicationUtil.getPublicationFromUrl(this.serviceManager, factory, url);
        } catch (Exception e) {
            throw new AccessControlException(e);
        } finally {
            if (util != null) {
View Full Code Here

                URLInformation info = new URLInformation(webappUrl);
                publicationId = info.getPublicationId();
            }

            DocumentFactory factory = DocumentUtil.getDocumentFactory(this.manager, request);

            String[] uris;

            if (factory.existsPublication(publicationId)) {
                Publication pub = factory.getPublication(publicationId);
                AllExistingSourceResolver resolver = new AllExistingSourceResolver();
                templateManager.visit(pub, path, resolver);
                uris = resolver.getUris();
            } else {
                uris = new String[0];
View Full Code Here

        String queryString = null;
        if (linkUrlAndQuery.length > 1) {
            queryString = linkUrlAndQuery[1];
        }

        DocumentFactory factory = this.area.getPublication().getFactory();

        String rewrittenUrl;

        try {
            if (factory.isDocument(linkUrl)) {
                Document targetDocument = factory.getFromURL(linkUrl);
                rewrittenUrl = getUuidBasedUri(targetDocument, anchor, queryString);
            } else {
                rewrittenUrl = webappUrl;
            }
        } catch (Exception e) {
View Full Code Here

     * @throws PublicationException if an error occurs.
     * @throws SiteException if an error occurs.
     */
    protected Document[] getDocuments() throws PublicationException, SiteException {
        Publication publication = getPublication();
        DocumentFactory identityMap = getDocumentFactory();
        Document[] documents;

        ServiceSelector selector = null;
        SiteManager siteManager = null;
        try {
View Full Code Here

     * @throws SiteException if an error occurs.
     */
    private DocumentStore getStore(Document document) throws SiteException {
        Publication publication = document.getPublication();
        String area = document.getArea();
        DocumentFactory map = document.getFactory();
        return getStore(map, publication, area);
    }
View Full Code Here

        Source confSource = null;
        ContextUtility util = null;
        try {
            util = (ContextUtility) this.manager.lookup(ContextUtility.ROLE);
            Request request = util.getRequest();
            DocumentFactory factory = DocumentUtil.getDocumentFactory(this.manager, request);
            pubManager = (PublicationManager) this.manager.lookup(PublicationManager.ROLE);
            Publication[] publications = pubManager.getPublications(factory);
            resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);

            for (int i = 0; i < publications.length; i++) {
View Full Code Here

        }
        finally {
            getManager().release(registry);
        }
       
        DocumentFactory factory = getFactory();
        Document source = factory.get(pub, Publication.AUTHORING_AREA, "/index", "en");
        Document target = factory.get(pub, Publication.AUTHORING_AREA, "/index", "en");
       
        MetaData sourceMeta = source.getMetaData(NAMESPACE);
        sourceMeta.setValue("copy", "sourceCopy");
        sourceMeta.setValue("ignore", "sourceIgnore");
        sourceMeta.setValue("delete", "sourceDelete");
View Full Code Here

                    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
View Full Code Here

            } else {
                throw new MalformedURLException("The path [" + absolutePath
                        + "] must start with at least one slash.");
            }

            DocumentFactory factory = DocumentUtil.getDocumentFactory(this.manager, request);
            Publication pub = factory.getPublication(pubId);
            SiteStructure site = pub.getArea(areaName).getSite();

            String[] steps = relativePath.substring(1).split("/");

            String language = steps[0];
View Full Code Here

TOP

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

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.