Package org.apache.lenya.cms.publication

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


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

      Publication pub = getPublication("test");
      Area area = pub.getArea(Publication.AUTHORING_AREA);
      Area trashArea = pub.getArea("trash");
      SiteStructure site = area.getSite();
      SiteNode node = site.getNode(PATH);
      Document doc_en = node.getLink("en").getDocument();
      Document doc_de = node.getLink("de").getDocument();

      DocumentLocator loc = DocumentLocator.getLocator(pub.getId(), "trash", PATH, doc_en.getLanguage());

      docMgr.copyAll(area, PATH, trashArea, PATH);

      SiteStructure trashSite = trashArea.getSite();
      assertTrue(trashSite.contains(PATH));
  } finally {
      if (docMgr != null) {
                getManager().release(docMgr);
            }
View Full Code Here


    public void testImport() throws Exception {

        Session session = login("lenya");

        Publication pub = getPublication(session, "test");
        Area area = pub.getArea("authoring");

        if (area.getDocuments().length == 0) {
            Publication defaultPub = getPublication(session, "default");
            Area defaultArea = defaultPub.getArea("authoring");
            String pubPath = defaultArea.getPublication().getDirectory().getAbsolutePath();
            String path = pubPath.replace(File.separatorChar, '/') + "/example-content";
            Importer importer = new Importer(getManager(), getLogger());
            importer.importContent(defaultPub, area, path);

            assertTrue(area.getSite().contains("/tutorial"));
View Full Code Here

     * @throws Exception
     */
    public void testLinks() throws Exception {

        Publication pub = getPublication("test");
        Area area = pub.getArea("authoring");
        SiteStructure site = area.getSite();

        Document source = site.getNode("/index").getLink("en").getDocument();
        Document target = site.getNode("/tutorial").getLink("en").getDocument();

        LinkManager linkManager = null;
View Full Code Here

        }

        final Document source = docs[0];

        final Publication pub = getPublication("test");
        final Area area = pub.getArea("authoring");
        final SiteStructure site = area.getSite();

        final Document target = site.getNode("/index").getLink("en").getDocument();
        final String queryString = "?format=xhtml";
        final String baseLink = "lenya-document:" + target.getUUID() + ",lang="
                + target.getLanguage();
View Full Code Here

        getLogger().info("Migrating publication [" + pub.getId() + "]");

        String[] areaNames = pub.getAreaNames();
        if (areaNames != null) {
            for (int i = 0; i < areaNames.length; i++) {
                Area area = pub.getArea(areaNames[i]);
                migrateArea(area);
            }
        }
    }
View Full Code Here

     * @throws Exception
     */
    public void testLinks() throws Exception {
       
        Publication pub = getPublication("test");
        Area area = pub.getArea("authoring");
        SiteStructure site = area.getSite();
       
        Document source = site.getNode("/index").getLink("en").getDocument();
        Document target = site.getNode("/tutorial").getLink("en").getDocument();
       
        LinkManager linkManager = null;
View Full Code Here

        URLInformation info = new URLInformation(url);
        String pubId = info.getPublicationId();

        DocumentFactory factory = getDocumentFactory();
        Publication pub = factory.getPublication(pubId);
        Area area = pub.getArea(info.getArea());

        Document[] docs = area.getDocuments();

        IndexUpdater updater = null;
        try {
            updater = (IndexUpdater) this.manager.lookup(IndexUpdater.ROLE);
            for (int i = 0; i < docs.length; i++) {
                try {
                    updater.index(getSession(), docs[i].getResourceType(), pubId, area.getName(),
                            docs[i].getUUID(), docs[i].getLanguage());
                } catch (Exception e) {
                    String message = "Error indexing document [" + docs[i].getPath() + ":"
                            + docs[i].getLanguage() + "], UUID=" + docs[i].getUUID();
                    addErrorMessage(e + ", see logfiles for more information.");
View Full Code Here

            Document[] documents = set.getDocuments();
            for (int i = 0; i < documents.length; i++) {
                nodes.add(documents[i].getRepositoryNode());
            }

            Area live = doc.getPublication().getArea(Publication.LIVE_AREA);
            nodes.add(live.getSite().getRepositoryNode());
            return (Node[]) nodes.toArray(new Node[nodes.size()]);

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

        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");
        DateFormat ofsfmt = new SimpleDateFormat("Z");
        Date date = new Date();
View Full Code Here

        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);
            }

            Document doc = area.getDocument(uuid, lang);

            store = new DocumentStore(doc, getLogger());
        } catch (Exception e) {
            throw new RepositoryException(e);
        }
View Full Code Here

TOP

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

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.