Package ch.entwine.weblounge.common.repository

Examples of ch.entwine.weblounge.common.repository.ContentRepository.find()


      // Order by date and limit the result set
      query.sortByPublishingDate(SearchQuery.Order.Descending);
      query.withLimit(count);

      // Finally Load the pages
      pages = repository.find(query);
    }

    boolean found = false;
    PageSearchResultItem item = null;
    Page page = null;
View Full Code Here


    for (String subject : subjects) {
      query.withSubject(subject);
    }

    // Load the result and add feed entries
    SearchResult result = contentRepository.find(query);
    List<SyndEntry> entries = new ArrayList<SyndEntry>();
    limit = result.getItems().length;

    while (limit > 0) {
      SearchResultItem item = result.getItems()[limit - 1];
View Full Code Here

    q.withTypes(Page.TYPE);

    // Return the result
    SearchResult result = null;
    try {
      result = repository.find(q);
    } catch (ContentRepositoryException e) {
      logger.error("Error trying to access the content repository", e);
      throw new WebApplicationException(e);
    }
View Full Code Here

      query.withVersion(Resource.LIVE);
      query.withTypes(ImageResource.TYPE);
      query.withSubjects(SearchQuery.Quantifier.All, imageSubjects.toArray(new String[imageSubjects.size()]));
      SearchResult result;
      try {
        result = repository.find(query);
      } catch (ContentRepositoryException e) {
        logger.warn("Error searching for image with given subjects ({}): {}", StringUtils.join(imageSubjects, ", "), e.getMessage());
        return SKIP_BODY;
      }
      if (result.getHitCount() > 1)
View Full Code Here

    query.withFulltext(text.toString());

    // Is it a page?
    Formatter formatter = null;
    try {
      SearchResult result = repository.find(query);

      // Format the output
      formatter = new Formatter(System.out);
      StringBuffer format = new StringBuffer();
      int padding = Long.toString(result.getDocumentCount()).length();
View Full Code Here

    query.withTypes(ImageResource.TYPE);
    for (int i = 0; i < imageSubjects.size(); i++)
      query.withSubject(imageSubjects.get(i));
    SearchResult result;
    try {
      result = repository.find(query);
    } catch (ContentRepositoryException e) {
      logger.warn("Error searching for image with given subjects.");
      return SKIP_BODY;
    }
View Full Code Here

    q.withPathPrefix(page.getURI().getPath());

    ContentRepository repository = getContentRepository(site, false);
    SearchResult result = null;
    try {
      result = repository.find(q);
    } catch (ContentRepositoryException e) {
      return Response.status(Status.INTERNAL_SERVER_ERROR).build();
    }

    StringBuffer buf = new StringBuffer("<pages>");
View Full Code Here

    q.withProperty("resourceid", pageId);

    ContentRepository repository = getContentRepository(site, false);
    SearchResult result = null;
    try {
      result = repository.find(q);
    } catch (ContentRepositoryException e) {
      return Response.status(Status.INTERNAL_SERVER_ERROR).build();
    }

    StringBuffer buf = new StringBuffer("<pages>");
View Full Code Here

        ResourceURI uri = new PageURIImpl(q.getSite(), q.getPath(), q.getVersion());
        pageByPath = (Page) repository.get(uri);
        int count = pageByPath != null ? 1 : 0;
        result = new SearchResultImpl(q, count, count);
      } else {
        result = repository.find(q);
      }
    } catch (ContentRepositoryException e) {
      throw new WebApplicationException(e);
    }
View Full Code Here

      throw new WebApplicationException(e);
    }

    // Return the result
    try {
      SearchResult result = repository.find(query);
      return Response.ok(result.toXml()).build();
    } catch (ContentRepositoryException e) {
      logger.error("Error trying to access the content repository", e);
      throw new WebApplicationException(e);
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.