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

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


          throws IOException, ParserConfigurationException, SAXException {

    InputStream is = null;
    Page page = null;
    try {
      PageReader pageReader = new PageReader();
      is = IOUtils.toInputStream(pageXml, "utf-8");
      page = pageReader.read(is, site);
    } finally {
      IOUtils.closeQuietly(is);
    }

    // Load the composer
View Full Code Here


    Page page = null;
    logger.info("Requesting the page's modification date at {}", requestUrl);
    try {
      HttpResponse response = TestUtils.request(httpClient, getPageRequest, null);
      assertEquals(HttpServletResponse.SC_OK, response.getStatusLine().getStatusCode());
      PageReader reader = new PageReader();
      page = reader.read(response.getEntity().getContent(), site);
    } finally {
      httpClient.getConnectionManager().shutdown();
    }

    DateFormat df = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'", Locale.US);
View Full Code Here

    page2URI = new PageURIImpl(site, page2path, page2uuid);
    imageURI = new ImageResourceURIImpl(site, imagePath, imageUuid);
    documentURI = new FileResourceURIImpl(site, documentPath, documentUuid);

    // Prepare the pages
    PageReader pageReader = new PageReader();
    pages = new Page[2];
    for (int i = 0; i < pages.length; i++) {
      InputStream is = this.getClass().getResourceAsStream("/page" + (i + 1) + ".xml");
      pages[i] = pageReader.read(is, site);
    }

    // Prepare the sample file
    FileResourceReader fileReader = new FileResourceReader();
    InputStream fileIs = this.getClass().getResourceAsStream("/file.xml");
View Full Code Here

    ElasticSearchUtils.createIndexConfigurationAt(idxRoot);
    idx = new SearchIndexImplStub();
    idx.bindResourceSerializerService(serializer);

    // Prepare the pages
    PageReader pageReader = new PageReader();
    InputStream is = null;

    // Add the live page
    try {
      is = SearchIndexFulltextTest.class.getResourceAsStream(pageFile);
      livePage = pageReader.read(is, site);
      pagelet = livePage.getPagelets()[0];
      idx.add(livePage);
    } finally {
      IOUtils.closeQuietly(is);
    }

    // Add the work page
    try {
      is = SearchIndexFulltextTest.class.getResourceAsStream(pageFile);
      workPage = pageReader.read(is, site);
      workPage.setVersion(Resource.WORK);
      idx.add(workPage);
    } finally {
      IOUtils.closeQuietly(is);
    }
View Full Code Here

   *           if setup of the index fails
   */
  @Before
  public void setUp() throws Exception {
    // Prepare the pages
    PageReader pageReader = new PageReader();
    pages = new Page[2];
    for (int i = 0; i < pages.length; i++) {
      InputStream is = this.getClass().getResourceAsStream("/page" + (i + 1) + ".xml");
      pages[i] = pageReader.read(is, site);
      IOUtils.closeQuietly(is);
    }

    // Prepare the sample file
    FileResourceReader fileReader = new FileResourceReader();
View Full Code Here

    }

    // Parse the page and update it in the repository
    Page page = null;
    try {
      PageReader pageReader = new PageReader();
      page = pageReader.read(IOUtils.toInputStream(pageXml, "utf-8"), site);
      if (StringUtils.isBlank(page.getURI().getPath()))
        throw new WebApplicationException(Status.PRECONDITION_FAILED);
      page.setModified(user, new Date());
      page.setVersion(Resource.WORK);
View Full Code Here

    PageImpl page = null;
    URI uri = null;
    if (!StringUtils.isBlank(pageXml)) {
      logger.debug("Adding page to {}", pageURI);
      try {
        PageReader pageReader = new PageReader();
        page = pageReader.read(IOUtils.toInputStream(pageXml, "utf-8"), site);
        page.setIdentifier(pageURI.getIdentifier());
        page.setPath(pageURI.getPath());
        page.setVersion(pageURI.getVersion());
      } catch (IOException e) {
        logger.warn("Error reading page {} from request", pageURI);
View Full Code Here

    ResourceURI liveURI = new PageURIImpl(site, null, pageId, Resource.LIVE);
    try {
      workPage = (Page) contentRepository.get(workURI);
      if (workPage == null) {
        logger.debug("Creating work version of {}", liveURI);
        PageReader reader = new PageReader();
        Page livePage = (Page) contentRepository.get(liveURI);
        workPage = reader.read(IOUtils.toInputStream(livePage.toXml(), "utf-8"), site);
        workPage.setVersion(Resource.WORK);
        contentRepository.putAsynchronously(workPage, false);
      } else {
        workURI.setPath(workPage.getURI().getPath());
      }
View Full Code Here

      }
    }

    // Finally, perform the publish operation
    try {
      PageReader reader = new PageReader();
      Page livePage = reader.read(IOUtils.toInputStream(workPage.toXml(), "utf-8"), site);
      livePage.setVersion(Resource.LIVE);
      if (setModified)
        livePage.setModified(user, new Date());
      if (!livePage.isPublished())
        livePage.setPublished(user, startDate, endDate);
View Full Code Here

    try {
      contentRepository.delete(liveURI);
      ResourceURI workURI = new ResourceURIImpl(liveURI, Resource.WORK);
      if (!contentRepository.exists(workURI)) {
        logger.debug("Creating work version of {}", workURI);
        PageReader reader = new PageReader();
        Page workPage = reader.read(IOUtils.toInputStream(livePage.toXml(), "utf-8"), site);
        workPage.setVersion(Resource.WORK);
        workPage.setPublished(null, null, null);
        contentRepository.putAsynchronously(workPage);
      }
      logger.info("Page {} has been unpublished by {}", liveURI, user);
View Full Code Here

TOP

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

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.