Package org.apache.lenya.cms.publication

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


        SiteManager siteManager = null;
        try {
            Request request = ObjectModelHelper.getRequest(this.objectModel);
            Session session = RepositoryUtil.getSession(this.manager, request);
            DocumentFactory map = DocumentUtil.createDocumentFactory(this.manager, session);
            Publication publication = PublicationUtil.getPublication(this.manager, request);

            selector = (ServiceSelector) this.manager.lookup(SiteManager.ROLE + "Selector");
            siteManager = (SiteManager) selector.select(publication.getSiteManagerHint());

            Document[] docs = siteManager.getDocuments(map, publication, area);
            Arrays.sort((Object[]) docs, new Comparator() {
                public int compare(Object o1, Object o2) {
                    try {
View Full Code Here


    protected void updateFeed() throws Exception {

        Document[] docs = new Document[2];
        org.w3c.dom.Document[] doms = new org.w3c.dom.Document[2];

        Publication pub = getSourceDocument().getPublication();
        Area authoring = pub.getArea(Publication.AUTHORING_AREA);
        Area live = pub.getArea(Publication.LIVE_AREA);
        String path = "/feeds/all/index";
        String language = pub.getDefaultLanguage();

        docs[0] = live.getSite().getNode(path).getLink(language).getDocument();
        docs[1] = authoring.getSite().getNode(path).getLink(language).getDocument();

        DateFormat datefmt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
View Full Code Here

     * @param document The document.
     * @return The store of the document.
     * @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

        String areaName = snippets[1];
        String uuid = snippets[2];
        DocumentStore store;
        try {
            DocumentFactory factory = DocumentUtil.createDocumentFactory(this.manager, session);
            Publication publication = factory.getPublication(publicationId);
            Area area = publication.getArea(areaName);
            String lang = publication.getDefaultLanguage();

            if (!area.contains(uuid, lang)) {
                createAreaVersion(publication, areaName, uuid, lang);
            }
View Full Code Here

        String publicationId = snippets[0];
        String areaName = snippets[1];
        SiteTree tree;
        try {
            DocumentFactory factory = DocumentUtil.createDocumentFactory(this.manager, session);
            Publication publication = factory.getPublication(publicationId);
            Area  area = publication.getArea(areaName);
           
            if (session.isModifiable() || session instanceof SharedItemStore) {
                tree = new SiteTreeImpl(this.manager, area, getLogger());
            }
            else {
View Full Code Here

            return null;
        }

        PageEnvelope envelope = null;
        Publication publication = null;
        Document document = null;

        try {
            envelope = PageEnvelopeFactory.getInstance().getPageEnvelope(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());
        rcmlDirectory = rcEnvironment.getRCMLDirectory();
        rcmlDirectory = publicationPath + File.separator + rcmlDirectory;
        backupDirectory = rcEnvironment.getBackupDirectory();
        backupDirectory = publicationPath + File.separator + backupDirectory;

        // Initialize Revision Controller
        rc = new RevisionController(rcmlDirectory, backupDirectory, publicationPath);
        getLogger().debug("revision controller" + 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("-bxeng");

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

            int l = documentid.length();
            int bxLength = "-bxeng".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);
                }
            }

            DocumentBuilder builder = publication.getDocumentBuilder();

            String srcUrl =
                builder.buildCanonicalUrl(publication, document.getArea(), documentid, language);
            Document srcDoc = builder.buildDocument(publication, srcUrl);
            File newFile = srcDoc.getFile();
View Full Code Here

            this.ignoreAElement = false;

            String href = attrs.getValue(ATTRIBUTE_HREF);
            if (href != null) {

                Publication publication = getCurrentDocument().getPublication();
                DocumentBuilder builder = publication.getDocumentBuilder();

                try {

                    newAttrs = new AttributesImpl(attrs);

                    if (getLogger().isDebugEnabled()) {
                        getLogger().debug(this.indent + "href URL: [" + href + "]");
                    }

                    String context = this.request.getContextPath();

                    if (href.startsWith(context + "/" + publication.getId())) {
                       
                        final String webappUrlWithAnchor = href.substring(context.length());
                       
                        String anchor = null;
                        String webappUrl = null;
View Full Code Here

     * @see PageEnvelope
     * @see RevisionController
     */
    public RevisionController getRevisionController(FOM_Cocoon cocoon)
    throws PageEnvelopeException, IOException {       
        final Publication publication = getPageEnvelope(cocoon).getPublication();
        final String publicationPath = publication.getDirectory().getCanonicalPath();
        final RCEnvironment rcEnvironment = RCEnvironment.getInstance(publication.getServletContext().getCanonicalPath());
        String rcmlDirectory = rcEnvironment.getRCMLDirectory();
        rcmlDirectory = publicationPath + File.separator + rcmlDirectory;
        String backupDirectory = rcEnvironment.getBackupDirectory();
        backupDirectory = publicationPath + File.separator + backupDirectory;

View Full Code Here

    public void reservedCheckIn(FOM_Cocoon cocoon, boolean backup)
    throws FileReservedCheckInException, Exception
    {
        final Identity identity = (Identity) ObjectModelHelper.getRequest(cocoon.getObjectModel()).getSession().getAttribute(Identity.class.getName());
        final PageEnvelope pageEnvelope = getPageEnvelope(cocoon);
        final Publication publication = getPageEnvelope(cocoon).getPublication();
        final String filename = pageEnvelope.getDocument().getFile().getCanonicalPath().substring(publication.getDirectory().getCanonicalPath().length());  
        getRevisionController(cocoon).reservedCheckIn(filename, identity.getUser().getId(), backup);
    }
View Full Code Here

        File rootDir = new File(rootDirName);
        TransformerFactory tFactory = TransformerFactory.newInstance();

        Transformer transformer = tFactory.newTransformer(new StreamSource(stylesheet));

        Publication publication = getPublication();
        DocumentBuilder builder = publication.getDocumentBuilder();

        // replace all internal links
        String oldURL =
            getContextPrefix() + builder.buildCanonicalUrl(publication, area, oldDcoumentId);
        String newURL =
            getContextPrefix() + builder.buildCanonicalUrl(publication, area, newDocumentId);

        log("Replace '" + oldURL + "' by '" + newURL + "'");
        transformer.setParameter("idbefore", oldURL);
        transformer.setParameter("idafter", newURL);

        replace_internal(rootDir, transformer);

        // now also do the replacement for all language versions
        String[] languages = publication.getLanguages();
        for (int i = 0; i < languages.length; i++) {
            String language = languages[i];

            oldURL =
                getContextPrefix()
View Full Code Here

TOP

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

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.