Examples of InvalidCriteriaException


Examples of com.baasbox.dao.exception.InvalidCriteriaException

        ));
    Integer records=null;
    try{
      records=DbHelper.sqlCommandExecute(command, null);
    }catch (OQueryParsingException e ){
      throw new InvalidCriteriaException("Invalid criteria. Please check if your querystring is encoded in a corrected way. Double check the single-quote and the quote characters",e);
    }catch (OCommandSQLParsingException e){
      throw new InvalidCriteriaException(e);
    }
    return records;
  }
View Full Code Here

Examples of com.baasbox.dao.exception.InvalidCriteriaException

    try{
      list = DbHelper.commandExecute(new OSQLSynchQuery<ODocument>(
        query
        ), null);
    }catch (OQueryParsingException e ){
      throw new InvalidCriteriaException("Invalid criteria. Please check if your querystring is encoded in a corrected way. Double check the single-quote and the quote characters",e);
    }catch (OCommandSQLParsingException e){
      throw new InvalidCriteriaException(e);
   
    return list;
  }
View Full Code Here

Examples of com.baasbox.dao.exception.InvalidCriteriaException

    List<ODocument> result = null;
    OCommandRequest command = DbHelper.selectCommandBuilder(MODEL_NAME, false, criteria);
    try{
      result = DbHelper.selectCommandExecute(command, criteria.getParams());
    }catch (OCommandExecutionException e ){
      throw new InvalidCriteriaException("Invalid criteria. Please check if your querystring is encoded in a corrected way. Double check the single-quote and the quote characters",e);
     
    }catch (OQueryParsingException e ){
      throw new InvalidCriteriaException("Invalid criteria. Please check if your querystring is encoded in a corrected way. Double check the single-quote and the quote characters",e);
    }catch (OCommandSQLParsingException e){
      throw new InvalidCriteriaException(e);
    }catch (StringIndexOutOfBoundsException e){
      throw new InvalidCriteriaException("Invalid criteria. Please check your query, the syntax and the parameters",e);
    }catch (IndexOutOfBoundsException e){
      throw new InvalidCriteriaException("Invalid criteria. Please check your query, the syntax and the parameters",e);
    }
    if (Logger.isTraceEnabled()) Logger.trace("Method End");
    return result;
  }
View Full Code Here

Examples of com.baasbox.dao.exception.InvalidCriteriaException

    List<ODocument> result = null;
    OCommandRequest command = DbHelper.selectCommandBuilder(MODEL_NAME, true, criteria);
    try{
      result = DbHelper.selectCommandExecute(command, criteria.getParams());
    }catch (OCommandExecutionException e ){
      throw new InvalidCriteriaException("Invalid criteria. Please check if your querystring is encoded in a corrected way. Double check the single-quote and the quote characters",e);
     
    }catch (OQueryParsingException e ){
      throw new InvalidCriteriaException("Invalid criteria. Please check if your querystring is encoded in a corrected way. Double check the single-quote and the quote characters",e);
    }catch (OCommandSQLParsingException e){
      throw new InvalidCriteriaException(e);
    }
    if (Logger.isTraceEnabled()) Logger.trace("Method End");
    return ((Long)result.get(0).field("count")).longValue();
  }
View Full Code Here

Examples of com.baasbox.dao.exception.InvalidCriteriaException

    OCommandRequest command = DbHelper.selectCommandBuilder(oclass, false, criteria);
    List<ODocument> result = null;
    try{
      result = DbHelper.selectCommandExecute(command, criteria.getParams());
    }catch (OCommandSQLParsingException e){
      throw new InvalidCriteriaException(e);
    }
    return result;
  }
View Full Code Here

Examples of com.tll.criteria.InvalidCriteriaException

  @Override
  public <E extends IEntity> List<SearchResult> find(Criteria<E> criteria, Sorting sorting)
      throws InvalidCriteriaException, DataAccessException {
    if(criteria == null) {
      throw new InvalidCriteriaException("No criteria specified.");
    }
    if(criteria.getCriteriaType() == null) {
      throw new InvalidCriteriaException("A criteria type must be specified.");
    }
    final List<E> list = findEntities(criteria, sorting);

    // transform list
    // TODO handle case where we want a sub-set of properties (a tuple scalar)
View Full Code Here

Examples of com.tll.criteria.InvalidCriteriaException

  @SuppressWarnings("rawtypes")
  @Override
  public <E extends IEntity> List<E> findEntities(Criteria<E> criteria, final Sorting sorting)
      throws InvalidCriteriaException, DataAccessException {
    if(criteria == null) throw new InvalidCriteriaException("No criteria specified.");

    final Query query = getDb4oTemplate().query();

    if(criteria.getCriteriaType().isQuery()) {
      if(nqt == null) throw new InvalidCriteriaException("No db4o named query translator specified.");
      nqt.translateNamedQuery(criteria.getNamedQueryDefinition(), criteria.getQueryParams(), query);
    }
    else {
      query.constrain(criteria.getEntityClass());
      final CriterionGroup pg = criteria.getPrimaryGroup();
      if(pg != null && pg.isSet()) {
        for(final ICriterion ic : pg) {
          if(ic.isGroup()) throw new InvalidCriteriaException("Nested criterion groups are not supported");
          if(!ic.isSet()) throw new InvalidCriteriaException("criterion not set");
          final Criterion ctn = (Criterion) ic;
          final Object checkValue = ctn.getValue();
          final String pname = ctn.getPropertyName();

          Query pquery;
          if(pname.indexOf('.') > 0) {
            pquery = query;
            // descend one time for each node in the pname (which may be a dot
            // notated property path)
            final PropertyPath path = new PropertyPath(pname);
            for(final String node : path.nodes()) {
              pquery = pquery.descend(node);
            }
          }
          else {
            pquery = query.descend(pname);
          }

          switch(ctn.getComparator()) {
            case BETWEEN: {
              Object min, max;
              if(checkValue instanceof NumberRange) {
                final NumberRange range = (NumberRange) checkValue;
                min = range.getMinimumNumber();
                max = range.getMaximumNumber();
              }
              else if(checkValue instanceof DateRange) {
                final DateRange range = (DateRange) checkValue;
                min = range.getStartDate();
                max = range.getEndDate();
              }
              else {
                // presume an object array
                final Object[] oarr = (Object[]) checkValue;
                min = oarr[0];
                max = oarr[1];
              }
              pquery.constrain(min).greater().equal().or(pquery.constrain(max).smaller().equal());
              break;
            }
            case CONTAINS:
              pquery.constrain(checkValue).contains();
              break;
            case ENDS_WITH:
              pquery.constrain(checkValue).endsWith(ctn.isCaseSensitive());
              break;
            case EQUALS:
              if(!ctn.isCaseSensitive())
                throw new InvalidCriteriaException("Case insensitive equals checking is currently not supported");
              pquery.constrain(checkValue);
              break;
            case GREATER_THAN:
              pquery.constrain(checkValue).greater();
              break;
            case GREATER_THAN_EQUALS:
              pquery.constrain(checkValue).greater().equal();
              break;
            case IN: {
              Object[] arr;
              if(checkValue.getClass().isArray()) {
                arr = (Object[]) checkValue;
              }
              else if(checkValue instanceof Collection<?>) {
                arr = ((Collection) checkValue).toArray();
              }
              else if(checkValue instanceof String) {
                // assume comma-delimited string
                arr =
                    org.springframework.util.ObjectUtils.toObjectArray(org.springframework.util.StringUtils
                        .commaDelimitedListToStringArray((String) checkValue));
              }
              else {
                throw new InvalidCriteriaException(
                    "Unsupported or null type for IN comparator: " + checkValue == null ? "<null>" : checkValue
                        .getClass().toString());
              }
              Constraint c = null;
              for(final Object o : arr) {
                if(c == null) {
                  c = pquery.constrain(o);
                }
                else {
                  c.or(pquery.constrain(o));
                }
              }
              break;
            }
            case IS:
              if(checkValue instanceof DBType == false) {
                throw new InvalidCriteriaException("IS clauses support only check values of type: "
                    + DBType.class.getSimpleName());
              }
              final DBType dbType = (DBType) checkValue;
              if(dbType == DBType.NULL) {
                // null
View Full Code Here

Examples of com.tll.criteria.InvalidCriteriaException

    case IN_MEMORY:
      return create(dataProvider.find(criteria, null), sorting);

    case IDLIST:
      if(criteria.getCriteriaType().isQuery()) {
        throw new InvalidCriteriaException("Id list handling does not support query based criteria");
      }
      slh = new PrimaryKeyListHandler<E>(dataProvider, criteria, sorting);
      break;

    case PAGE:
View Full Code Here

Examples of com.tll.criteria.InvalidCriteriaException

      else if("merchant".equals(et))
        sq = q.descend("isAvailableMerchant");
      else if("customer".equals(et))
        sq = q.descend("isAvailableCustomer");
      else
        throw new InvalidCriteriaException();
      sq.constrain(Boolean.TRUE);
    }

    else
      throw new InvalidCriteriaException("Unhandled named query: " + qname);
  }
View Full Code Here

Examples of com.tll.criteria.InvalidCriteriaException

  @Override
  public <E extends IEntity> List<SearchResult<?>> find(Criteria<E> criteria, Sorting sorting)
  throws InvalidCriteriaException, DataAccessException {
    if(criteria == null) {
      throw new InvalidCriteriaException("No criteria specified.");
    }
    if(criteria.getCriteriaType() == null) {
      throw new InvalidCriteriaException("A criteria type must be specified.");
    }
    final List<E> list = findEntities(criteria, sorting);

    // transform list
    // TODO handle case where we want a sub-set of properties (a tuple scalar)
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.