Package ch.entwine.weblounge.common.impl.content.page

Examples of ch.entwine.weblounge.common.impl.content.page.PageImpl


   */
  protected Page aggregate(Message message, Site site) throws IOException,
  MessagingException, IllegalArgumentException {

    ResourceURI uri = new PageURIImpl(site, UUID.randomUUID().toString());
    Page page = new PageImpl(uri);
    Language language = site.getDefaultLanguage();

    // Extract title and subject. Without these two, creating a page is not
    // feasible, therefore both messages throw an IllegalArgumentException if
    // the fields are not present.
    String title = getSubject(message);
    String author = getAuthor(message);

    // Collect default settings
    PageTemplate template = site.getDefaultTemplate();
    if (template == null)
      throw new IllegalStateException("Missing default template in site '" + site + "'");
    String stage = template.getStage();
    if (StringUtils.isBlank(stage))
      throw new IllegalStateException("Missing stage definition in template '" + template.getIdentifier() + "'");

    // Standard fields
    page.setTitle(title, language);
    page.setTemplate(template.getIdentifier());
    page.setPublished(new UserImpl(site.getAdministrator()), message.getReceivedDate(), null);

    // TODO: Translate e-mail "from" into site user and throw if no such
    // user can be found
    page.setCreated(site.getAdministrator(), message.getSentDate());

    // Start looking at the message body
    String contentType = message.getContentType();
    if (StringUtils.isBlank(contentType))
      throw new IllegalArgumentException("Message content type is unspecified");
View Full Code Here


   */
  @Test
  public void testDeleteResourceURIBoolean() throws IllegalStateException,
  ContentRepositoryException, IOException {
    ResourceURI workURI = new PageURIImpl(site, page1path, page1uuid, WORK);
    Page workPage = new PageImpl(workURI);
    workPage.setTemplate(template.getIdentifier());
    int resources = populateRepository();
    int revisions = resources;

    // Add resources and additional work resource
    repository.put(workPage);
View Full Code Here

      } else {
        subpath = root;
        rootURI = new PageURIImpl(site, root, id);
        uri = new PageURIImpl(site, root, id);
      }
      Page p = new PageImpl(uri);
      p.setTemplate(template.getIdentifier());
      repository.put(p);
    }

    // Make sure everything is the way we set it up
    SearchQuery q = new SearchQueryImpl(site).withTypes(Page.TYPE).withPath(root);
View Full Code Here

  IllegalStateException, IOException {
    ResourceURI live1URI = new PageURIImpl(site, "/weblounge");
    ResourceURI live2URI = new PageURIImpl(site, "/etc/weblounge");
    ResourceURI work2URI = new PageURIImpl(site, "/etc/weblounge", WORK);

    Page page1Live = new PageImpl(live1URI);
    Page page2Live = new PageImpl(live2URI);
    Page page2Work = new PageImpl(work2URI);

    page1Live.setTemplate(template.getIdentifier());
    page2Live.setTemplate(template.getIdentifier());
    page2Work.setTemplate(template.getIdentifier());

    // Add the pages to the index
    repository.put(page1Live);
    repository.put(page2Live);
    repository.put(page2Work);
View Full Code Here

   */
  @Test
  public void testWithoutPublication() throws IllegalStateException,
  ContentRepositoryException, IOException {
    ResourceURI workURI = new PageURIImpl(site, "/etc/weblounge", WORK);
    Page work = new PageImpl(workURI);
    work.setTemplate(template.getIdentifier());

    repository.put(work);

    SearchQuery q = new SearchQueryImpl(site);
    q.withoutPublication();
View Full Code Here

  IOException {
    int count = populateRepository();
    assertEquals(count, repository.getVersionCount() - 1);

    ResourceURI page1WorkURI = new PageURIImpl(page1URI, WORK);
    Page page2Work = new PageImpl(page1WorkURI);
    page2Work.setTemplate(template.getIdentifier());

    repository.put(page2Work);
    assertEquals(count + 1, repository.getVersionCount() - 1);
    repository.delete(page1URI, true);
    assertEquals(count - 1, repository.getVersionCount() - 1);
View Full Code Here

  @Test
  public void testLock() throws Exception {

    // Create pages and uris
    ResourceURI uriLive = new PageURIImpl(site, "/etc/weblounge");
    Page pageLive = new PageImpl(uriLive);
    pageLive.setTemplate(template.getIdentifier());
    ResourceURI uriWork = new PageURIImpl(site, "/etc/weblounge", WORK);
    Page pageWork = new PageImpl(uriWork);
    pageWork.setTemplate(template.getIdentifier());

    // Add the pages to the index
    repository.put(pageLive);
    repository.put(pageWork);
View Full Code Here

  @Test
  public void testUnlock() throws Exception {

    // Create pages and uris
    ResourceURI uriLive = new PageURIImpl(site, "/etc/weblounge");
    Page pageLive = new PageImpl(uriLive);
    pageLive.setTemplate(template.getIdentifier());
    ResourceURI uriWork = new PageURIImpl(site, "/etc/weblounge", WORK);
    Page pageWork = new PageImpl(uriWork);
    pageWork.setTemplate(template.getIdentifier());

    // Add the pages to the index
    repository.put(pageLive);
    repository.put(pageWork);
View Full Code Here

    ResourceURI liveOnlyURI = new PageURIImpl(site, "/liveonly", LIVE);
    ResourceURI liveAndWorkLiveURI = new PageURIImpl(site, "/liveandwork", LIVE);
    ResourceURI liveAndWorkWorkURI = new PageURIImpl(site, "/liveandwork", WORK);
    ResourceURI workOnlyURI = new PageURIImpl(site, "/workonly", WORK);

    Page liveOnly = new PageImpl(liveOnlyURI);
    liveOnly.setTemplate(template.getIdentifier());
    Page liveAndWorkLive = new PageImpl(liveAndWorkLiveURI);
    liveAndWorkLive.setTemplate(template.getIdentifier());
    Page liveAndWorkWork = new PageImpl(liveAndWorkWorkURI);
    liveAndWorkWork.setTemplate(template.getIdentifier());
    Page workOnly = new PageImpl(workOnlyURI);
    workOnly.setTemplate(template.getIdentifier());

    // Add the live only live page
    repository.put(liveOnly);
    assertEquals(0, repository.find(workOnlyQuery).getDocumentCount());
    assertEquals(1, repository.find(liveOnlyQuery).getDocumentCount());
View Full Code Here

    // module
    module.addRenderer(renderer);

    pageURI = new PageURIImpl(site, pageURIPath);
    page = new PageImpl(pageURI);
    actionUrl = new WebUrlImpl(site, UrlUtils.concat(siteUrl, mountpoint));
  }
View Full Code Here

TOP

Related Classes of ch.entwine.weblounge.common.impl.content.page.PageImpl

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.