@Test public void testGenerateCriteria_BetweenDate() { String lowerDateString = "1/1/2010"; DateTime lowerDate = DateTime.parse(lowerDateString, formatter).withTimeAtStartOfDay(); String upperDateString = "1/2/2010"; DateTime upperDate = DateTime.parse(upperDateString, formatter).withTimeAtStartOfDay(); Map<String, String> mapCriteria = new HashMap<String, String>(); mapCriteria.put("prop4", lowerDateString + SearchOperator.BETWEEN.op() + upperDateString); QueryByCriteria.Builder qbcBuilder = generator.generateCriteria(TestClass.class, mapCriteria, false); assertNotNull(qbcBuilder); QueryByCriteria qbc = qbcBuilder.build(); Predicate and = qbc.getPredicate(); assertTrue(and instanceof AndPredicate); Set<Predicate> predicates = ((AndPredicate) and).getPredicates(); assertEquals(2, predicates.size()); boolean foundProp4Lower = false; boolean foundProp4Upper = false; for (Predicate predicate : predicates) { if (predicate instanceof GreaterThanOrEqualPredicate) { foundProp4Lower = true; GreaterThanOrEqualPredicate greaterThanOrEqual = (GreaterThanOrEqualPredicate) predicate; assertEquals(greaterThanOrEqual.getValue().getValue(), lowerDate); } else if (predicate instanceof LessThanOrEqualPredicate) { foundProp4Upper = true; LessThanOrEqualPredicate lessThanOrEqual = (LessThanOrEqualPredicate) predicate; assertEquals(lessThanOrEqual.getValue().getValue(), upperDate.plusDays(1)); } } assertTrue(foundProp4Lower); assertTrue(foundProp4Upper); }
@Override @Deprecated public QueryByCriteria.Builder generateCriteria(Class<?> type, Map<String, String> formProps, boolean usePrimaryKeysOnly) { if (usePrimaryKeysOnly) { return getCollectionCriteriaFromMapUsingPrimaryKeysOnly(type, instantiateLookupDataObject(type), formProps).toQueryBuilder(); } else { return getCollectionCriteriaFromMap(type, instantiateLookupDataObject(type), formProps).toQueryBuilder(); } }
LookupCriteriaGeneratorImpl implements LookupCriteriaGenerator { @Override @Deprecated public QueryByCriteria.Builder generateCriteria(Class<?> type, Map<String, String> formProps, boolean usePrimaryKeysOnly) { if (usePrimaryKeysOnly) { return getCollectionCriteriaFromMapUsingPrimaryKeysOnly(type, instantiateLookupDataObject(type), formProps).toQueryBuilder(); } else { return getCollectionCriteriaFromMap(type, instantiateLookupDataObject(type), formProps).toQueryBuilder(); } } }
LookupCriteriaGeneratorImpl implements LookupCriteriaGenerator { @Override @Deprecated public QueryByCriteria.Builder generateCriteria(Class<?> type, Map<String, String> formProps, boolean usePrimaryKeysOnly) { if (usePrimaryKeysOnly) { return getCollectionCriteriaFromMapUsingPrimaryKeysOnly(type, instantiateLookupDataObject(type), formProps).toQueryBuilder(); } else { return getCollectionCriteriaFromMap(type, instantiateLookupDataObject(type), formProps).toQueryBuilder(); } }  }
LookupCriteriaGeneratorImpl implements LookupCriteriaGenerator { @Override @Deprecated public QueryByCriteria.Builder generateCriteria(Class<?> type, Map<String, String> formProps, boolean usePrimaryKeysOnly) { if (usePrimaryKeysOnly) { return getCollectionCriteriaFromMapUsingPrimaryKeysOnly(type, instantiateLookupDataObject(type), formProps).toQueryBuilder(); } else { return getCollectionCriteriaFromMap(type, instantiateLookupDataObject(type), formProps).toQueryBuilder(); } }  DateTimeService getDateTimeService(); void setDateTimeService(DateTimeService dateTimeService); DataDictionaryService getDataDictionaryService(); void setDataDictionaryService(DataDictionaryService dataDictionaryService); DatabasePlatform getDbPlatform(); void setDbPlatform(DatabasePlatform dbPlatform); DataObjectService getDataObjectService(); void setDataObjectService(DataObjectService dataObjectService); @Override @Deprecated QueryByCriteria.Builder generateCriteria(Class<?> type, Map<String, String> formProps, boolean usePrimaryKeysOnly); @Override QueryByCriteria.Builder generateCriteria(Class<?> type, Map<String, String> formProps,
            List<String> wildcardAsLiteralPropertyNames, boolean usePrimaryKeysOnly); @Override QueryByCriteria.Builder createObjectCriteriaFromMap(Object example, Map<String, String> formProps); boolean createCriteria(Object example, String searchValue, String propertyName, boolean caseInsensitive, boolean treatWildcardsAndOperatorsAsLiteral, Predicates criteria); }
LookupCriteriaGeneratorImpl implements LookupCriteriaGenerator { @Override @Deprecated public QueryByCriteria.Builder generateCriteria(Class<?> type, Map<String, String> formProps, boolean usePrimaryKeysOnly) { if (usePrimaryKeysOnly) { return getCollectionCriteriaFromMapUsingPrimaryKeysOnly(type, instantiateLookupDataObject(type), formProps).toQueryBuilder(); } else { return getCollectionCriteriaFromMap(type, instantiateLookupDataObject(type), formProps).toQueryBuilder(); } }  DateTimeService getDateTimeService(); void setDateTimeService(DateTimeService dateTimeService); DataDictionaryService getDataDictionaryService(); void setDataDictionaryService(DataDictionaryService dataDictionaryService); DatabasePlatform getDbPlatform(); void setDbPlatform(DatabasePlatform dbPlatform); DataObjectService getDataObjectService(); void setDataObjectService(DataObjectService dataObjectService); @Override @Deprecated QueryByCriteria.Builder generateCriteria(Class<?> type, Map<String, String> formProps, boolean usePrimaryKeysOnly); @Override QueryByCriteria.Builder generateCriteria(Class<?> type, Map<String, String> formProps,
            List<String> wildcardAsLiteralPropertyNames, boolean usePrimaryKeysOnly); @Override QueryByCriteria.Builder createObjectCriteriaFromMap(Object example, Map<String, String> formProps); boolean createCriteria(Object example, String searchValue, String propertyName, boolean caseInsensitive, boolean treatWildcardsAndOperatorsAsLiteral, Predicates criteria);  }