Package com.gentics.cr

Examples of com.gentics.cr.CRRequest


        Collection<CRResolvableBean> objectsToIndex = null;
        //Clear Index and remove stale Documents
        //if (!create) {
        log.debug("Will do differential index.");
        try {
          CRRequest req = new CRRequest();
          req.setRequestFilter(rule);
          req.set(CR_FIELD_KEY, crid);
          status.setCurrentStatusString("Get objects to update " + "in the index ...");
          objectsToIndex = getObjectsToUpdate(req, rp, false, luceneIndexUpdateChecker);
        } catch (Exception e) {
          log.error("ERROR while cleaning index", e);
        }
View Full Code Here


      final List<String> reverseattributes, final TaxonomyWriter taxonomyWriter, final TaxonomyAccessor taxonomyAccessor)
      throws CRException, IOException {
    // prefill all needed attributes
    UseCase uc = MonitorFactory.startUseCase("indexSlice(" + crid + ")");
    try {
      CRRequest req = new CRRequest();
      String[] prefillAttributes = attributes.keySet().toArray(new String[0]);
      req.setAttributeArray(prefillAttributes);
      UseCase prefillCase = MonitorFactory.startUseCase("indexSlice(" + crid + ").prefillAttributes");
      rp.fillAttributes(slice, req, idAttribute);
      prefillCase.stop();
      for (Resolvable objectToIndex : slice) {
        CRResolvableBean bean = new CRResolvableBean(objectToIndex, prefillAttributes);
View Full Code Here

    String path = tmpFile.getParent();
    String name = tmpFile.getName();
    CRResolvableBean bean;
    if (path != null && !path.equals("")) {
      bean = config.getNewRequestProcessorInstance(1).getFirstMatchingResolvable(
          new CRRequest("object.filename == '" + name + "' AND object.pub_dir == '" + path + "'"));
    } else {
      RequestProcessor rp = config.getNewRequestProcessorInstance(1);
      assertNotNull("Cannot get RequestProcessor from config", rp);
      bean = rp.getFirstMatchingResolvable(new CRRequest("object.filename == '" + name + "'"));
    }
    assertEquals("The contents of the file do not match the content of the RequestProcessor. Therefore the file was not updated.",
        bean.get("binarycontent"), filecontent);
  }
View Full Code Here

    return search(query, searchedAttributes, count, start, explain, null);
  }

  public HashMap<String, Object> search(final String query, final String[] searchedAttributes, final int count, final int start,
      final boolean explain, final String[] sorting) throws IOException, CRException {
    return search(query, searchedAttributes, count, start, explain, sorting, new CRRequest());
  }
View Full Code Here

        rule = "1 == 1";
      }


      try {
        CRRequest req = new CRRequest();
        req.setRequestFilter(rule);
        status.setCurrentStatusString("SYN Get objects to update " + "in the index ...");
        objectsToIndex = getObjectsToUpdate(req, rp, true, null);
      } catch (Exception e) {
        log.error("ERROR while cleaning SYN index", e);
      }
View Full Code Here

   */
  @Override
  protected void indexCR(final IndexLocation indexLocation, final CRConfigUtil config) throws CRException {
    Collection<CRResolvableBean> objectsToIndex = null;
    try {
      CRRequest req = new CRRequest();
      req.setRequestFilter(config.getString("rule", "1==1"));
      status.setCurrentStatusString("Get objects to update in the directory ...");
      objectsToIndex = getObjectsToUpdate(req, rp, false, indexUpdateChecker);
    } catch (Exception e) {
      LOGGER.error("ERROR while cleaning index", e);
    }
View Full Code Here

      } else {
        atts = prefillAttributes;
      }
      Collection<Resolvable> coll = (Collection<Resolvable>) ds.getResult(filter, atts);
      for (Resolvable res : coll) {
        CRRequest req = new CRRequest();
        req.setUrl((String) res.get("pub_dir") + (String) res.get("filename"));
        this.getObject(req);
      }

    } catch (FilterGeneratorException e) {
      log.error("Could not create filter with cacheWarmRule (" + cacheWarmRule + ") expression.");
View Full Code Here

  public final CRResolvableBean getObject(final CRRequest request) {
    CRResolvableBean contentObject = null;
    String url = request.getUrl();
    if (url != null) {

      CRRequest r = new CRRequest();

      PathBean pb = new PathBean(request.getUrl());
      String path = pb.getPath();

      String filter = "";
      if (path == null || "".equals(path)) {
        filter = "(pub_dir:(/)) AND filename:(" + pb.getFilename() + ")";
      } else {
        filter = "(pub_dir:(" + pb.getPath() + ") OR pub_dir:(" + pb.getPath() + "/)) AND filename:("
            + pb.getFilename() + ")";
      }
      log.debug("Using filter: " + filter);
      r.setRequestFilter(filter);
      try {
        contentObject = rp.getFirstMatchingResolvable(r);
      } catch (CRException e) {
        log.error("Could not load object from path " + url, e);
      }
View Full Code Here

  /**
   * Create BinaryRequest.
   */
  public CRRequest getBinaryRequest() {
    CRRequest req = this.getCRRequest();
    req.setDoReplacePlinks(this.doreplacePlinks);
    //TODO parameterize doVelocity
    req.setDoVelocity(true);
    if (this.isurlrequest) {
      req.setUrl(this.url);
    }
    return req;
  }
View Full Code Here

  @Override
  protected void setUp() throws Exception {
    super.setUp();
    parser = new CRQueryParser(LuceneVersion.getVersion(), SEARCHED_ATTRIBUTES, STANDARD_ANALYZER);
    crRequest = new CRRequest();
    lucene = new SimpleLucene();

    documents = new ArrayList<ComparableDocument>();
    /* 0 */documents.add(new ComparableDocument(lucene.add(
      SimpleLucene.CONTENT_ATTRIBUTE + ":word9 word1",
View Full Code Here

TOP

Related Classes of com.gentics.cr.CRRequest

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.