|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.kuali.rice.core.jdbc.SqlBuilder
public class SqlBuilder
This is a description of what this class does - Garey don't forget to fill this in.
Field Summary | |
---|---|
private DateTimeService |
dateTimeService
|
private DatabasePlatform |
dbPlatform
|
private static org.apache.log4j.Logger |
LOG
|
Constructor Summary | |
---|---|
SqlBuilder()
|
Method Summary | |
---|---|
private void |
addAndCriteria(String propertyName,
String propertyValue,
Class propertyType,
boolean caseInsensitive,
Criteria criteria,
boolean allowWildcards)
|
void |
addCriteria(String propertyName,
String propertyValue,
Class propertyType,
boolean caseInsensitive,
boolean allowWildcards,
Criteria criteria)
|
private void |
addDateRangeCriteria(String propertyName,
String propertyValue,
Criteria criteria,
Class propertyType)
|
private void |
addLogicalOperatorCriteria(String propertyName,
String propertyValue,
Class propertyType,
boolean caseInsensitive,
Criteria criteria,
String splitValue,
boolean allowWildcards)
|
private void |
addNotCriteria(String propertyName,
String propertyValue,
Class propertyType,
boolean caseInsensitive,
Criteria criteria,
boolean allowWildcards)
|
private void |
addNumericRangeCriteria(String propertyName,
String propertyValue,
Criteria criteria,
Class propertyType)
|
private void |
addOrCriteria(String propertyName,
String propertyValue,
Class propertyType,
boolean caseInsensitive,
Criteria criteria,
boolean allowWildcards)
|
private void |
addStringRangeCriteria(String propertyName,
String propertyValue,
Criteria criteria,
Class propertyType,
boolean caseInsensitive,
boolean allowWildcards)
|
void |
andCriteria(Criteria addToThisCriteria,
Criteria newCriteria)
|
void |
andCriteria(String columnName,
String searchValue,
String tableName,
String tableAlias,
Class propertyType,
boolean caseInsensitive,
boolean allowWildcards,
Criteria addToThisCriteria)
|
static String |
cleanDate(String string)
|
static String |
cleanNumeric(String value)
|
static String |
cleanNumericOfValidOperators(String string)
|
private static String |
cleanUpperBound(String stringDate)
When dealing with upperbound dates, it is a business requirement that if a timestamp isn't already stated append 23:59:59 to the end of the date. |
static boolean |
containsRangeCharacters(String string)
|
private static String |
convertSimpleDateToDateRange(String stringDate)
This method will take a whole date like 03/02/2009 and convert it into 03/02/2009 .. |
Criteria |
createCriteria(String columnName,
String searchValue,
String tableName,
String tableAlias,
Class propertyType)
|
Criteria |
createCriteria(String columnName,
String searchValue,
String tableName,
String tableAlias,
Class propertyType,
boolean caseInsensitive,
boolean allowWildcards)
|
private String |
getCaseAndLiteralPropertyName(String propertyName,
boolean caseInsensitive)
|
private String |
getCaseAndLiteralPropertyValue(String propertyValue,
boolean caseInsensitive,
boolean allowWildcards)
|
static List<String> |
getCleanedSearchableValues(String valueEntered,
String propertyDataType)
This method splits the values then cleans them of any other query characters like *?!><... |
protected DateTimeService |
getDateTimeService()
|
DatabasePlatform |
getDbPlatform()
|
protected static void |
getSearchableValueRecursive(String valueEntered,
List lRet)
|
static List<String> |
getSearchableValues(String valueEntered)
This method splits the valueEntered on locical operators and, or, and between |
boolean |
isValidDate(String dateString)
|
static boolean |
isValidNumber(String value)
|
void |
orCriteria(String columnName,
String searchValue,
String tableName,
String tableAlias,
Class propertyType,
boolean caseInsensitive,
boolean allowWildcards,
Criteria addToThisCriteria)
|
private Timestamp |
parseDate(String dateString)
|
void |
setDateTimeService(DateTimeService dateTimeService)
|
void |
setDbPlatform(DatabasePlatform dbPlatform)
|
static BigDecimal |
stringToBigDecimal(String value)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final org.apache.log4j.Logger LOG
private DateTimeService dateTimeService
private DatabasePlatform dbPlatform
Constructor Detail |
---|
public SqlBuilder()
Method Detail |
---|
public Criteria createCriteria(String columnName, String searchValue, String tableName, String tableAlias, Class propertyType)
public Criteria createCriteria(String columnName, String searchValue, String tableName, String tableAlias, Class propertyType, boolean caseInsensitive, boolean allowWildcards)
public void andCriteria(String columnName, String searchValue, String tableName, String tableAlias, Class propertyType, boolean caseInsensitive, boolean allowWildcards, Criteria addToThisCriteria)
public void andCriteria(Criteria addToThisCriteria, Criteria newCriteria)
public void orCriteria(String columnName, String searchValue, String tableName, String tableAlias, Class propertyType, boolean caseInsensitive, boolean allowWildcards, Criteria addToThisCriteria)
public void addCriteria(String propertyName, String propertyValue, Class propertyType, boolean caseInsensitive, boolean allowWildcards, Criteria criteria)
public Object findObjectByMap(Object example, Map formProps) {
Criteria jpaCriteria = new Criteria(example.getClass().getName());
Iterator propsIter = formProps.keySet().iterator();
while (propsIter.hasNext()) {
String propertyName = (String) propsIter.next();
String searchValue = "";
if (formProps.get(propertyName) != null) {
searchValue = (formProps.get(propertyName)).toString();
}
if (StringUtils.isNotBlank(searchValue) & PropertyUtils.isWriteable(example, propertyName)) {
Class propertyType = ObjectUtils.getPropertyType(example, propertyName, persistenceStructureService);
if (TypeUtils.isIntegralClass(propertyType) || TypeUtils.isDecimalClass(propertyType)) {
if (propertyType.equals(Long.class)) {
jpaCriteria.eq(propertyName, new Long(searchValue));
} else {
jpaCriteria.eq(propertyName, new Integer(searchValue));
}
} else if (TypeUtils.isTemporalClass(propertyType)) {
jpaCriteria.eq(propertyName, parseDate(ObjectUtils.clean(searchValue)));
} else {
jpaCriteria.eq(propertyName, searchValue);
}
}
}
return new QueryByCriteria(entityManager, jpaCriteria).toQuery().getSingleResult();
}
private void addOrCriteria(String propertyName, String propertyValue, Class propertyType, boolean caseInsensitive, Criteria criteria, boolean allowWildcards)
private void addAndCriteria(String propertyName, String propertyValue, Class propertyType, boolean caseInsensitive, Criteria criteria, boolean allowWildcards)
private void addNotCriteria(String propertyName, String propertyValue, Class propertyType, boolean caseInsensitive, Criteria criteria, boolean allowWildcards)
private void addLogicalOperatorCriteria(String propertyName, String propertyValue, Class propertyType, boolean caseInsensitive, Criteria criteria, String splitValue, boolean allowWildcards)
private Timestamp parseDate(String dateString)
public boolean isValidDate(String dateString)
public static String cleanDate(String string)
public static boolean containsRangeCharacters(String string)
private void addDateRangeCriteria(String propertyName, String propertyValue, Criteria criteria, Class propertyType)
public static boolean isValidNumber(String value)
public static String cleanNumericOfValidOperators(String string)
public static String cleanNumeric(String value)
public static BigDecimal stringToBigDecimal(String value)
private void addNumericRangeCriteria(String propertyName, String propertyValue, Criteria criteria, Class propertyType)
private void addStringRangeCriteria(String propertyName, String propertyValue, Criteria criteria, Class propertyType, boolean caseInsensitive, boolean allowWildcards)
private String getCaseAndLiteralPropertyName(String propertyName, boolean caseInsensitive)
private String getCaseAndLiteralPropertyValue(String propertyValue, boolean caseInsensitive, boolean allowWildcards)
protected DateTimeService getDateTimeService()
public void setDateTimeService(DateTimeService dateTimeService)
dateTimeService
- the dateTimeService to setpublic DatabasePlatform getDbPlatform()
public void setDbPlatform(DatabasePlatform dbPlatform)
private static String cleanUpperBound(String stringDate)
private static String convertSimpleDateToDateRange(String stringDate)
stringDate
-
public static List<String> getCleanedSearchableValues(String valueEntered, String propertyDataType)
valueEntered
- propertyDataType
-
public static List<String> getSearchableValues(String valueEntered)
valueEntered
-
protected static void getSearchableValueRecursive(String valueEntered, List lRet)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |