Package com.gentics.api.lib.expressionparser.filtergenerator

Examples of com.gentics.api.lib.expressionparser.filtergenerator.DatasourceFilter


    }
    contentids.add(bean.getContentid());
  }
 
  public void cleanUp() throws CRException {
    DatasourceFilter dsFilter;
    try {
      CRResolvableBean base = new CRResolvableBean();
      base.set("contentids", contentids);
      dsFilter = wDs.createDatasourceFilter(PortalConnectorFactory.createExpression("object.contentid CONTAINSONEOF base.contentids"));
      dsFilter.addBaseResolvable("base", base);
      wDs.delete(dsFilter);
    } catch (Exception e) {
      throw new CRException(e);
    } finally {
      CRDatabaseFactory.releaseDatasource(wDs);
View Full Code Here


   * @throws ParserException
   * @throws ExpressionParserException
   */
  public DatasourceFilter getPreparedFilter(CRConfig config, Datasource ds) throws ParserException,
      ExpressionParserException {
    DatasourceFilter dsFilter;
    String filter = "";
    if (ds == null) {
      ds = config.getDatasource();
    }

    if ((this.getRequestFilter() == null || this.getRequestFilter().equals("")) && this.getContentid() != null
        && !this.getContentid().equals("")) {
      this.setRequestFilter("object.contentid=='" + this.getContentid() + "'");
    }

    // TEST IF REQUEST FILTER IS SAVE
    Expression expression = PortalConnectorFactory.createExpression(this.getRequestFilter());
    // IF NO EXCEPTION IS THROWN IN THE ABOVE STATEMENT, FILTER IS
    // CONSIDERED TO BE SAVE

    // ADD APPLICATION RULE IF IT IS SET
    if (config.getApplicationRule() == null || config.getApplicationRule().equals("")) {
      filter = this.getRequestFilter();
    } else if (config.getApplicationRule() != null && !config.getApplicationRule().equals("")
        && this.getRequestFilter() != null && !this.getRequestFilter().equals("")) {
      filter = "(" + this.getRequestFilter() + ") AND " + config.getApplicationRule();
    } else if (config.getApplicationRule() != null && !config.getApplicationRule().equals("")
        && (this.getRequestFilter() == null || this.getRequestFilter().equals(""))) {
      filter = config.getApplicationRule();
    }
    log.debug("Using rule: " + filter);
    expression = PortalConnectorFactory.createExpression(filter);

    dsFilter = ds.createDatasourceFilter(expression);
    Iterator<String> it = this.getObjectsToDeploy().keySet().iterator();
    while (it.hasNext()) {
      String key = it.next();
      dsFilter.addBaseResolvable(key, this.getObjectsToDeploy().get(key));
    }
    return (dsFilter);
  }
View Full Code Here

  public final Collection<CRResolvableBean> getObjects(
      final CRRequest request,
      final boolean doNavigation)
      throws CRException {
    Datasource ds = null;
    DatasourceFilter dsFilter;
    Collection<CRResolvableBean> collection = null;
   
    if (request != null) {
      RequestWrapper rW = request.getRequestWrapper();
      String rootId = rW.getParameter(ROOT_ID);
      // Parse the given expression and create a datasource filter
      try {
        ds = this.config.getDatasource();
        if (ds == null) {
          throw (new DatasourceException("No Datasource available."));
        }

        dsFilter = request.getPreparedFilter(config, ds);

        // add base resolvables
        if (this.resolvables != null) {
          for (Iterator<String> it = this.resolvables
              .keySet().iterator(); it.hasNext();) {
            String name = it.next();
            dsFilter.addBaseResolvable(name,
                this.resolvables.get(name));
          }
        }

       
View Full Code Here

      for (String lang : langs) {
        langPrefills.add("contentid_" + lang);
      }
    }
    Datasource ds = null;
    DatasourceFilter dsFilter;
    Vector<CRResolvableBean> collection = new Vector<CRResolvableBean>();
 
    //GENERATE LANG REQUEST
    CRRequest myREQ = request.Clone();
    myREQ.setCountString("-1");
    myREQ.setStartString("0");

    // Parse the given expression and create a datasource filter
    try {
      ds = this.config.getDatasource();
      if (ds == null) {
        throw (new DatasourceException("No Datasource available."));
      }

      dsFilter = myREQ.getPreparedFilter(config, ds);

      // add base resolvables
      if (this.resolvables != null) {
        for (Iterator<String> it = this.resolvables.keySet().iterator(); it.hasNext();) {
          String name = it.next();
          dsFilter.addBaseResolvable(name, this.resolvables.get(name));
        }
      }

      Collection<Resolvable> fallbackedColl = new ArrayList<Resolvable>();
      // do the query
View Full Code Here

   */
  public final Collection<CRResolvableBean> getObjects(final CRRequest request, final boolean doNavigation)
      throws CRException {
    UseCase getObjectCase = MonitorFactory.startUseCase("CRRequestProcessor.getObjects(" + config.getName() + ")");
    Datasource ds = null;
    DatasourceFilter dsFilter;
    Vector<CRResolvableBean> collection = new Vector<CRResolvableBean>();
    if (request != null) {
      // Parse the given expression and create a datasource filter
      try {
        ds = this.config.getDatasource();
        if (ds == null) {
          throw (new DatasourceException("No Datasource available."));
        }

        dsFilter = request.getPreparedFilter(config, ds);
        // add base resolvables
        if (this.resolvables != null) {
          for (Iterator<String> it = this.resolvables.keySet().iterator(); it.hasNext();) {
            String name = it.next();
            dsFilter.addBaseResolvable(name, this.resolvables.get(name));
          }
        }

        String[] prefillAttributes = request.getAttributeArray();
        int first = request.getStart().intValue();
View Full Code Here

   * @throws CRException TODO javadocs
   */
  public Collection<CRResolvableBean> getObjects(final CRRequest request, final boolean doNavigation)
      throws CRException {
    Datasource ds = null;
    DatasourceFilter dsFilter;
    Vector<CRResolvableBean> collection = new Vector<CRResolvableBean>();
    if (request != null) {

      // Parse the given expression and create a datasource filter
      try {
        ds = this.config.getDatasource();
        if (ds == null) {
          throw (new DatasourceException("No Datasource available."));
        }

        dsFilter = request.getPreparedFilter(config, ds);

        // add base resolvables
        if (this.resolvables != null) {
          for (Iterator<String> it = this.resolvables.keySet().iterator(); it.hasNext();) {
            String name = it.next();
            dsFilter.addBaseResolvable(name, this.resolvables.get(name));
          }
        }

        String[] prefillAttributes = request.getAttributeArray();
        prefillAttributes = ArrayHelper.removeElements(prefillAttributes, "contentid", "updatetimestamp");
View Full Code Here

    Datasource ds = null;
    try {

      // prepare the filter
      ds = this.conf.getDatasource();
      DatasourceFilter filter = ds.createDatasourceFilter(ExpressionParser.getInstance().parse(cacheWarmRule));

      // use the filter to get matching objects
      String[] atts = null;
      if (fast) {
        atts = fastprefillAttributes;
View Full Code Here

    if (url != null) {
      try {

        // prepare the filter
        ds = this.conf.getDatasource();
        DatasourceFilter filter = ds.createDatasourceFilter(expression);

        //Deploy base objects
        Iterator<String> it = request.getObjectsToDeploy().keySet().iterator();
        while (it.hasNext()) {
          String key = it.next();
          filter.addBaseResolvable(key, request.getObjectsToDeploy().get(key));
        }

        // add the data to the filter
        filter.addBaseResolvable("data", new PathBean(url));

        // use the filter to get matching objects
        Collection<Resolvable> objects = ds.getResult(filter, request.getAttributeArray());

        Iterator<Resolvable> i = objects.iterator();
View Full Code Here

            log.error("Error while building expression object for " + contentid, exception);
            System.out.println("Error while building expression object for " + contentid);
            ret = getDynamicUrl(contentid);
          }

          DatasourceFilter filter = null;
          try {
            filter = ds.createDatasourceFilter(expression);
          } catch (ExpressionParserException e) {
            log.error("Error while building filter object for " + contentid, e);
            ret = getDynamicUrl(contentid);
View Full Code Here

          } catch (ParserException exception) {
            log.error("Error while building expression object for " + contentid, exception);
            ret = getDynamicUrl(contentid);
          }

          DatasourceFilter filter = null;
          try {
            filter = ds.createDatasourceFilter(expression);
          } catch (ExpressionParserException e) {
            log.error("Error while building filter object for " + contentid, e);
            ret = getDynamicUrl(contentid);
View Full Code Here

TOP

Related Classes of com.gentics.api.lib.expressionparser.filtergenerator.DatasourceFilter

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.