public class SqlJdbcUtil extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
SqlJdbcUtil.FieldType
An enumeration of the various data types supported by the entity engine.
|
| Constructor and Description |
|---|
SqlJdbcUtil() |
| Modifier and Type | Method and Description |
|---|---|
static int |
countWhereStringParametersFromFields(List<ModelField> modelFields,
Map<String,?> fieldValues) |
static String |
filterColName(String colName) |
static SqlJdbcUtil.FieldType |
getFieldType(String javaType)
Does the same thing as
getType(String), except that it returns an enum type instead
of a magic number and doesn't throw a checked exception. |
static int |
getType(String javaType) |
static void |
getValue(ResultSet rs,
int ind,
ModelField curField,
GenericEntity entity,
ModelFieldTypeReader modelFieldTypeReader) |
static boolean |
isBoolean(String fieldType)
Indicates whether the given field type represents a Boolean field.
|
static String |
makeFromClause(ModelEntity modelEntity,
DatasourceInfo datasourceInfo)
Makes the FROM clause and when necessary the JOIN clause(s) as well
|
static String |
makeOrderByClause(ModelEntity modelEntity,
List<String> orderBy,
boolean includeTablenamePrefix,
DatasourceInfo datasourceInfo) |
static String |
makeOrderByClause(ModelEntity modelEntity,
List<String> orderBy,
DatasourceInfo datasourceInfo) |
static String |
makeViewTable(ModelEntity modelEntity,
DatasourceInfo datasourceInfo) |
static String |
makeViewWhereClause(ModelEntity modelEntity,
String joinStyle) |
static String |
makeWhereClause(ModelEntity modelEntity,
List<ModelField> modelFields,
Map<String,?> fields,
String operator,
String joinStyle) |
static String |
makeWhereStringFromFields(List<ModelField> modelFields,
Map<String,?> fieldValues,
String operator)
Makes a WHERE clause String with "
|
static String |
makeWhereStringFromFields(List<ModelField> modelFields,
Map<String,?> fieldValues,
String operator,
List<? super EntityConditionParam> entityConditionParams)
Makes a WHERE clause String with "
|
static void |
setPkValues(SQLProcessor sqlP,
ModelEntity modelEntity,
GenericEntity entity,
ModelFieldTypeReader modelFieldTypeReader)
Get all primary keys from the model entity and bind their values
to the an SQL statement (SQL-Processor)
|
static void |
setValue(SQLProcessor sqlP,
ModelField modelField,
GenericEntity entity,
ModelFieldTypeReader modelFieldTypeReader) |
static void |
setValue(SQLProcessor sqlP,
ModelField modelField,
String entityName,
Object fieldValue,
ModelFieldTypeReader modelFieldTypeReader) |
static void |
setValues(SQLProcessor sqlP,
List<ModelField> list,
GenericEntity entity,
ModelFieldTypeReader modelFieldTypeReader)
The elements (ModelFields) of the list are bound to an SQL statement
(SQL-Processor)
|
static void |
setValuesWhereClause(SQLProcessor sqlP,
List<ModelField> list,
GenericValue dummyValue,
ModelFieldTypeReader modelFieldTypeReader)
The elements (ModelFields) of the list are bound to an SQL statement
(SQL-Processor), but values must not be null.
|
public static final String module
public static boolean isBoolean(String fieldType)
FieldType.BOOLEAN.matches(fieldType)fieldType - the field type to checkpublic static String makeFromClause(ModelEntity modelEntity, DatasourceInfo datasourceInfo) throws GenericEntityException
GenericEntityExceptionpublic static String makeWhereStringFromFields(List<ModelField> modelFields, Map<String,?> fieldValues, String operator)
modelFields - the fields to include in the WHERE string (can be null)fieldValues - any field values to be checked against non-null values; keys are field (not column) namesoperator - the operator to insert between each column condition in the returned WHERE string (typically
"AND" or "OR")public static int countWhereStringParametersFromFields(List<ModelField> modelFields, Map<String,?> fieldValues)
public static String makeWhereStringFromFields(List<ModelField> modelFields, Map<String,?> fieldValues, String operator, List<? super EntityConditionParam> entityConditionParams)
modelFields - the fields to include in the WHERE string (can be null)fieldValues - any field values to be checked against non-null values; keys are field (not column) namesoperator - the operator to insert between each column
condition in the returned WHERE string (typically "AND" or "OR")entityConditionParams - if not null, an element will be added to this listpublic static String makeWhereClause(ModelEntity modelEntity, List<ModelField> modelFields, Map<String,?> fields, String operator, String joinStyle) throws GenericEntityException
GenericEntityExceptionpublic static String makeViewWhereClause(ModelEntity modelEntity, String joinStyle) throws GenericEntityException
GenericEntityExceptionpublic static String makeOrderByClause(ModelEntity modelEntity, List<String> orderBy, DatasourceInfo datasourceInfo)
public static String makeOrderByClause(ModelEntity modelEntity, List<String> orderBy, boolean includeTablenamePrefix, DatasourceInfo datasourceInfo)
public static String makeViewTable(ModelEntity modelEntity, DatasourceInfo datasourceInfo) throws GenericEntityException
GenericEntityExceptionpublic static void setValues(SQLProcessor sqlP, List<ModelField> list, GenericEntity entity, ModelFieldTypeReader modelFieldTypeReader) throws GenericEntityException
sqlP - list - entity - modelFieldTypeReader - GenericEntityExceptionpublic static void setValuesWhereClause(SQLProcessor sqlP, List<ModelField> list, GenericValue dummyValue, ModelFieldTypeReader modelFieldTypeReader) throws GenericEntityException
sqlP - list - dummyValue - modelFieldTypeReader - GenericEntityExceptionpublic static void setPkValues(SQLProcessor sqlP, ModelEntity modelEntity, GenericEntity entity, ModelFieldTypeReader modelFieldTypeReader) throws GenericEntityException
sqlP - modelEntity - entity - modelFieldTypeReader - GenericEntityExceptionpublic static void getValue(ResultSet rs, int ind, ModelField curField, GenericEntity entity, ModelFieldTypeReader modelFieldTypeReader) throws GenericEntityException
GenericEntityExceptionpublic static void setValue(SQLProcessor sqlP, ModelField modelField, GenericEntity entity, ModelFieldTypeReader modelFieldTypeReader) throws GenericEntityException
GenericEntityExceptionpublic static void setValue(SQLProcessor sqlP, ModelField modelField, String entityName, Object fieldValue, ModelFieldTypeReader modelFieldTypeReader) throws GenericEntityException
GenericEntityExceptionpublic static int getType(String javaType) throws GenericNotImplementedException
GenericNotImplementedException@Nonnull public static SqlJdbcUtil.FieldType getFieldType(String javaType)
getType(String), except that it returns an enum type instead
of a magic number and doesn't throw a checked exception.javaType - the java type to resolve to a field typeIllegalArgumentException - if the java class type is unsupportedCopyright © 2016 Atlassian. All rights reserved.