Package com.im.df.api.ddl
Class DFFields
- java.lang.Object
-
- com.im.df.api.ddl.DFFields
-
public final class DFFields extends java.lang.ObjectUtility methods forDFField.- Author:
- pzajac
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDFFields.PredicatesPredicates related toDFFields.
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static DFFieldcreateBinaryField(DFEntity entity, java.lang.String fieldName, java.lang.String columnName, com.im.commons.progress.DFEnvironmentRW env)Create new binary standard field.static DFFieldcreateBooleanField(DFEntity entity, java.lang.String fieldName, java.lang.String columnName, com.im.commons.progress.DFEnvironmentRW env)Create new boolean standard field.static DFFieldcreateChemTermsField(DFEntity entity, java.lang.String fieldName, com.im.commons.db.ddl.GenericColumnType fieldType, java.lang.String formula, com.im.commons.progress.DFEnvironmentRW env)Creates a new chemical terms field inside given entity according to provided parameters.static DFFieldcreateDateField(DFEntity entity, java.lang.String fieldName, java.lang.String columnName, com.im.commons.progress.DFEnvironmentRW env)Create new date field with default column type.static DFFieldcreateDateField(DFEntity entity, java.lang.String fieldName, java.lang.String columnName, com.im.commons.progress.DFEnvironmentRW env, com.im.commons.db.ddl.DBDatabaseInfo.ColumnSQLType sqlType)Create new date field with specific column type.static DFFieldcreateDynamicURLField(DFEntity entity, java.lang.String fieldName, java.lang.String mimeType, java.lang.String urlTemplate, DFField[] params, com.im.commons.progress.DFEnvironmentRW env)Create a new dynamic URL field.static DFFieldcreateFloatField(DFEntity entity, java.lang.String fieldName, java.lang.String columnName, int size, int scale, com.im.commons.progress.DFEnvironmentRW env)Create new float standard field with default column type.static DFFieldcreateIntegerField(DFEntity entity, java.lang.String fieldName, java.lang.String columnName, com.im.commons.progress.DFEnvironmentRW env)Create new integer standard field.static DFFieldcreateStaticURLField(DFEntity entity, java.lang.String fieldName, java.lang.String columnName, int size, java.lang.String mimeType, com.im.commons.progress.DFEnvironmentRW env)Create a new static URL field with default column type.static DFFieldcreateTextArrayField(DFEntity entity, java.lang.String fieldName, java.lang.String columnName, int size, com.im.commons.progress.DFEnvironmentRW env)Create new text list field with default column type (VARCHAR).static DFFieldcreateTextField(DFEntity entity, java.lang.String fieldName, java.lang.String columnName, int size, com.im.commons.progress.DFEnvironmentRW env)Create new text standard field with default column type (VARCHAR).static java.util.Collection<? extends DFField>findDependentFields(java.util.Collection<? extends DFField> fields)Finds calculated fields (means fields withDFFieldCalcCapabilitythat use the fields passed in.static DFFieldfindStructureField(DFEntity entity)Finds Structure field if it's available.static java.util.List<? extends DFField>forVertex(DFDataTree.Vertex vertex)static java.util.List<? extends DFField>forVertex(DFDataTree.Vertex vertex, boolean recursive)static java.util.List<? extends DFField>forVertexState(DFResultSet.VertexState vertexState)Getsfieldsthat belong to avertexState.static java.util.List<? extends DFField>forVertexState(DFResultSet.VertexState vertexState, boolean recursive)Getsfieldswhich belong to avertexStateand its descendants reachable recursively viaN:1or1:1relationships.static java.util.List<? extends DFField>getCategoryFields(DFEntity entity)Deprecated.usegetGroupFields(DFEntity)instead; this method will be removed in post-5.12 releasestatic java.util.List<? extends DFField>getCategoryFields(java.util.List<? extends DFField> fields)Deprecated.usegetGroupFields(List)instead; this method will be removed in post-5.12 releasestatic java.util.List<? extends DFField>getGroupFields(DFEntity entity)Return fields belonging to the given entity which are appropriate to be used as a group field.static java.util.List<? extends DFField>getGroupFields(java.util.List<? extends DFField> fields)Take the givenfieldsand returns only those which are appropriate to be used as a group field.static DFFieldgetIDField(DFResultSet.VertexState vs)static booleanhasEditableValues(DFField field)Tests if values of the given field can be edited.static booleanisBinary(DFField field)Test if this field is of Binary type.static booleanisBoolean(DFField field)Test if this field is of Boolean type.static booleanisCalculated(DFField field)Test if this field is Calculated field.static booleanisChemicalTerms(DFField field)Test if this field is Chemical terms field.static booleanisDate(DFField field)Test if this field is of Date type.static booleanisDateTime(DFField field)Informs whether field can store date and time or only date.static booleanisDBField(DFField field)Test if this field is DB based.static booleanisDynamicURL(DFField field)Test if this field is of Dynamic URL type.static booleanisEditableValue(DFField field)Check whether or not data for the field in entity can be edited.static booleanisExtension(DFField field)Test if this field is Extension field.static booleanisFloat(DFField field)Test if this field is of a decimal number type.static booleanisID(DFField field)Tests whether the given field is an ID field within its owning entity.static booleanisInteger(DFField field)Test if this field is of Integer type.static booleanisRelationField(DFField field)Check if column of field represents foreign key.static booleanisSortable(DFField field)Informs whether the field is capable to be sorted.static booleanisStandard(DFField field)Test if this field is Standard field.static booleanisStaticURL(DFField field)Test if this field is of Static URL type.static booleanisStructure(DFField field)Test if this field is of Structure type.static booleanisText(DFField field)Test if this field is of Text type.static booleanisURL(DFField field)Test if this field is of URL type.static java.util.List<java.lang.String>toNames(java.util.List<? extends DFField> fields)Deprecated.
-
-
-
Method Detail
-
isID
public static boolean isID(DFField field)
Tests whether the given field is an ID field within its owning entity.- Parameters:
field- field to be checked- Returns:
- if the field is an ID field
-
toNames
@Deprecated public static java.util.List<java.lang.String> toNames(java.util.List<? extends DFField> fields)
Deprecated.Function mapping fields to their names.- Parameters:
fields- fields to map- Returns:
- fields' names
-
getGroupFields
public static java.util.List<? extends DFField> getGroupFields(DFEntity entity)
Return fields belonging to the given entity which are appropriate to be used as a group field. I.e. the data represented by such field can be partitioned into disjoint groups in sensible manner without using explicit equivalence relation. Examples of such fields are integer, text, boolean, etc. fields. Counter example is float field where explicit equivalence relation is needed to get disjoint equivalence classes.- Parameters:
entity- the entity- Returns:
- group fields
-
getGroupFields
public static java.util.List<? extends DFField> getGroupFields(java.util.List<? extends DFField> fields)
Take the givenfieldsand returns only those which are appropriate to be used as a group field. I.e. the data represented by such field can be partitioned into disjoint groups in sensible manner without using explicit equivalence relation. Examples of such fields are integer, text, boolean, etc. fields. Counter example is float field where explicit equivalence relation is needed to get disjoint equivalence classes.- Parameters:
fields- fields from which to select group fields- Returns:
- group fields
-
getCategoryFields
@Deprecated public static java.util.List<? extends DFField> getCategoryFields(DFEntity entity)
Deprecated.usegetGroupFields(DFEntity)instead; this method will be removed in post-5.12 releaseReturn fields belonging to the given entity which are appropriate to be used as a category field. That is integer, text, boolean, etc. fields.- Parameters:
entity- the entity- Returns:
- category fields
-
getCategoryFields
@Deprecated public static java.util.List<? extends DFField> getCategoryFields(java.util.List<? extends DFField> fields)
Deprecated.usegetGroupFields(List)instead; this method will be removed in post-5.12 releaseTake the givenfieldsand returns only those which are appropriate to be used as a category field. That is integer, text, boolean, etc. fields.- Parameters:
fields- fields from which to select category fields- Returns:
- category fields
-
createIntegerField
public static DFField createIntegerField(DFEntity entity, java.lang.String fieldName, java.lang.String columnName, com.im.commons.progress.DFEnvironmentRW env)
Create new integer standard field.- Parameters:
entity- Target entity.fieldName- Name of new field.columnName- Name of column for the new field.env- Locked environment.- Returns:
- new integer field
-
createBooleanField
public static DFField createBooleanField(DFEntity entity, java.lang.String fieldName, java.lang.String columnName, com.im.commons.progress.DFEnvironmentRW env)
Create new boolean standard field.- Parameters:
entity- Target entity.fieldName- Name of new field.columnName- Name of column for the new field.env- Locked environment.- Returns:
- new boolean field.
-
createFloatField
public static DFField createFloatField(DFEntity entity, java.lang.String fieldName, java.lang.String columnName, int size, int scale, com.im.commons.progress.DFEnvironmentRW env)
Create new float standard field with default column type.- Parameters:
entity- Target entity.fieldName- Name of new field.columnName- Name of column for the new field.size- if value is -1 default value will be usedscale- if value is -1 default value will be usedenv- Locked environment.- Returns:
- new float field.
-
createTextField
public static DFField createTextField(DFEntity entity, java.lang.String fieldName, java.lang.String columnName, int size, com.im.commons.progress.DFEnvironmentRW env)
Create new text standard field with default column type (VARCHAR). If the default column type can't be created (e.g. because the size exceeds VARCHAR's limit on a particular DB, the following types are tried:- CLOB
- TEXT
- BLOB
- Parameters:
entity- Target entity.fieldName- Name of new field.columnName- Name of column for the new field.size- of column, if value is -1 default value will be usedenv- Locked environment.- Returns:
- new text field
-
createTextArrayField
public static DFField createTextArrayField(DFEntity entity, java.lang.String fieldName, java.lang.String columnName, int size, com.im.commons.progress.DFEnvironmentRW env)
Create new text list field with default column type (VARCHAR). If the default column type can't be created (e.g. because the size exceeds VARCHAR's limit on a particular DB, the following types are tried:- CLOB
- TEXT
- BLOB
- Parameters:
entity- Target entity.fieldName- Name of new field.columnName- Name of column for the new field.size- of column, if value is -1 default value will be usedenv- Locked environment.- Returns:
- new text list field
-
createDateField
public static DFField createDateField(DFEntity entity, java.lang.String fieldName, java.lang.String columnName, com.im.commons.progress.DFEnvironmentRW env)
Create new date field with default column type.- Parameters:
entity- Target entity.fieldName- Name of new field.columnName- Name of column for the new field.env- Locked environment.- Returns:
- new date field
-
createDateField
public static DFField createDateField(DFEntity entity, java.lang.String fieldName, java.lang.String columnName, com.im.commons.progress.DFEnvironmentRW env, com.im.commons.db.ddl.DBDatabaseInfo.ColumnSQLType sqlType)
Create new date field with specific column type.- Parameters:
entity- Target entity.fieldName- Name of new field.columnName- Name of column for the new field.env- Locked environment.sqlType- Specified sql type- Returns:
- new date field
- Since:
- 16.7.11
-
createBinaryField
public static DFField createBinaryField(DFEntity entity, java.lang.String fieldName, java.lang.String columnName, com.im.commons.progress.DFEnvironmentRW env)
Create new binary standard field.- Parameters:
entity- Target entity.fieldName- Name of new field.columnName- Name of column for the new field.env- Locked environment.- Returns:
- new integer field
-
createStaticURLField
public static DFField createStaticURLField(DFEntity entity, java.lang.String fieldName, java.lang.String columnName, int size, java.lang.String mimeType, com.im.commons.progress.DFEnvironmentRW env)
Create a new static URL field with default column type. This field is actually- Parameters:
entity- Target entity.fieldName- Name of new field.columnName- Name of column for the new field.size- of column, if value is -1 default value will be usedmimeType- mime type of target - for example "text/html", "image", etc.env- Locked environment.- Returns:
- new text field
-
createDynamicURLField
public static DFField createDynamicURLField(DFEntity entity, java.lang.String fieldName, java.lang.String mimeType, java.lang.String urlTemplate, DFField[] params, com.im.commons.progress.DFEnvironmentRW env)
Create a new dynamic URL field.- Parameters:
entity- The target entityfieldName- New field namemimeType- Mime type for content referenced by URL (e.g. "text/html" or "image")urlTemplate- URL template in format like "http://www.google.com/search?q="{0}"params- Fields used in urlTemplateenv- Environment with lock- Returns:
- New dynamic URL field
-
createChemTermsField
public static DFField createChemTermsField(DFEntity entity, java.lang.String fieldName, com.im.commons.db.ddl.GenericColumnType fieldType, java.lang.String formula, com.im.commons.progress.DFEnvironmentRW env)
Creates a new chemical terms field inside given entity according to provided parameters.- Parameters:
entity- The target entityfieldName- New CT field namefieldType- Field type - currently only these types are supported:GenericColumnType.FLOAT,GenericColumnType.INTEGER,GenericColumnType.TEXT,GenericColumnType.BOOLEANformula- The formulaenv- The environment with lock- Returns:
- Newly created CT field
-
findStructureField
public static DFField findStructureField(DFEntity entity)
Finds Structure field if it's available. For standard entities it returns null. Currently JChem tables support only one structure field, so it's unambiguous what field is returned.- Parameters:
entity- The entity to be scanned- Returns:
- structure field or null if it doesn't exist
- Since:
- 5.12
-
isInteger
public static boolean isInteger(DFField field)
Test if this field is of Integer type.- Parameters:
field- Field to be tested- Returns:
- true if field has
DFFieldIntegerCapability
-
isFloat
public static boolean isFloat(DFField field)
Test if this field is of a decimal number type. Values in a decimal number field can be either of java typeDoubleorFloat. As of 16.5.2 the values areDouble, but for backwards compatibilityFloatis still supported.- Parameters:
field- Field to be tested- Returns:
- true if field has
DFFieldFloatCapability
-
isText
public static boolean isText(DFField field)
Test if this field is of Text type.- Parameters:
field- Field to be tested- Returns:
- true if field has
DFFieldTextCapability
-
isBoolean
public static boolean isBoolean(DFField field)
Test if this field is of Boolean type.- Parameters:
field- Field to be tested- Returns:
- true if field has
DFFieldBooleanCapability
-
isDate
public static boolean isDate(DFField field)
Test if this field is of Date type.- Parameters:
field- Field to be tested- Returns:
- true if field has
DFFieldDateCapability
-
isDateTime
public static boolean isDateTime(DFField field)
Informs whether field can store date and time or only date.- Parameters:
field- Field bound to widget or renderer- Returns:
trueif field can store date and time;falseif field can store only date- Since:
- 16.6.13
-
isStructure
public static boolean isStructure(DFField field)
Test if this field is of Structure type.- Parameters:
field- Field to be tested- Returns:
- true if field has
DFFieldStructureCapability
-
isBinary
public static boolean isBinary(DFField field)
Test if this field is of Binary type.- Parameters:
field- Field to be tested- Returns:
- true if field has
DFFieldBinaryCapability
-
isURL
public static boolean isURL(DFField field)
Test if this field is of URL type. See alsoisDynamicURL(com.im.df.api.ddl.DFField)and {- Parameters:
field- Field to be tested- Returns:
- true if field has
DFFieldURLCapability- it means it true for both: dynamic and static column
-
isDynamicURL
public static boolean isDynamicURL(DFField field)
Test if this field is of Dynamic URL type. Dynamic URL field is a field which doesn't have a database column and URL is calculated on fly from a formula - e.g. www.chemaxon.com/search-results/?q={0}- Parameters:
field- Field to be tested- Returns:
- true if field has
DFFieldURLCapabilityand also hasDFFieldCalcCapability.
-
isStaticURL
public static boolean isStaticURL(DFField field)
Test if this field is of Static URL type. Static URL field is a field which contains URL as texts and it has a database column (it's subtype of text field (isText(com.im.df.api.ddl.DFField))- Parameters:
field- Field to be tested- Returns:
- true if field has
DFFieldURLCapabilityand doesn't haveDFFieldCalcCapability.
-
isCalculated
public static boolean isCalculated(DFField field)
Test if this field is Calculated field.- Parameters:
field- Field to be tested- Returns:
- true if field has
DFFieldCalculatedCapability
-
isExtension
public static boolean isExtension(DFField field)
Test if this field is Extension field.- Parameters:
field- field to be tested- Returns:
- true if field has
DFFieldExtensionCapability, false otherwise
-
isChemicalTerms
public static boolean isChemicalTerms(DFField field)
Test if this field is Chemical terms field.- Parameters:
field- Field to be tested- Returns:
- true if field has
DFFieldChemicalTermsCapability
-
isStandard
public static boolean isStandard(DFField field)
Test if this field is Standard field. Currently it means field is database field AND (not calculated) AND (not chemical terms).- Parameters:
field- Field to be tested- Returns:
- true if field has
DBFieldCapabilityand is notisCalculated(com.im.df.api.ddl.DFField)is notisChemicalTerms(com.im.df.api.ddl.DFField)
-
isDBField
public static boolean isDBField(DFField field)
Test if this field is DB based.- Parameters:
field- Field to be tested- Returns:
- true if field has
DBFieldCapability - Since:
- 17.3.20
-
isSortable
public static boolean isSortable(DFField field)
Informs whether the field is capable to be sorted.- Parameters:
field-- Returns:
- true if the field can be sorted, false otherwise
- Since:
- 19.19.0
-
findDependentFields
public static java.util.Collection<? extends DFField> findDependentFields(java.util.Collection<? extends DFField> fields)
Finds calculated fields (means fields withDFFieldCalcCapabilitythat use the fields passed in.- Parameters:
fields- The fields to find dependencies for.- Returns:
- A collection of calculated fields that use one or more of the fields passed in as their bound parameters.
-
isEditableValue
public static boolean isEditableValue(DFField field)
Check whether or not data for the field in entity can be edited.- Parameters:
field- input field.- Returns:
- true if data are editable.
-
isRelationField
public static boolean isRelationField(DFField field)
Check if column of field represents foreign key.- Parameters:
field- input field.- Returns:
- true if field represents foreign key.
-
forVertexState
public static java.util.List<? extends DFField> forVertexState(DFResultSet.VertexState vertexState)
Getsfieldsthat belong to avertexState. This method delegates toforVertexState(VertexState, boolean)with therecursiveparameter set tofalse. It's a convenience method for callingvertexState.getVertex().getEntity().getFields().getItems().- Parameters:
vertexState- The vertex state to get fields for.- Returns:
- An immutable list of
DFFields that belong thevertexState's vertex.
-
forVertexState
public static java.util.List<? extends DFField> forVertexState(DFResultSet.VertexState vertexState, boolean recursive)
Getsfieldswhich belong to avertexStateand its descendants reachable recursively viaN:1or1:1relationships.- Parameters:
vertexState- The vertex state to get fields for.recursive- Iftruethe method will followN:1and1:1relationships from thevertexState.getVertex()recursively and collect all fields in all vertices that it can reach. Iffalsethe method will just return the fields from thevertexState.getVertex()itself.- Returns:
- An immutable list of
DFFields. - Since:
- 6.4
-
forVertex
public static java.util.List<? extends DFField> forVertex(DFDataTree.Vertex vertex)
Getsfieldsthat belong to avertex. This method delegates toforVertex(com.im.df.api.ddl.DFDataTree.Vertex, boolean)with therecursiveparameter set tofalse. It's a convenience method for callingvertex.getEntity().getFields().getItems().- Parameters:
vertex- The vertex to get fields for.- Returns:
- An immutable list of
DFFields that belong thevertex.
-
forVertex
public static java.util.List<? extends DFField> forVertex(DFDataTree.Vertex vertex, boolean recursive)
Getsfieldswhich belong to avertexand its descendants reachable recursively viaN:1or1:1relationships.- Parameters:
vertex- The vertex to get fields for.recursive- Iftruethe method will followN:1and1:1relationships from thevertexrecursively and collect all fields in all vertices that it can reach. Iffalsethe method will just return the fields from thevertexitself.- Returns:
- An immutable list of
DFFields. - Since:
- 6.3
-
getIDField
public static DFField getIDField(DFResultSet.VertexState vs)
- Parameters:
vs- the vertex state of interest- Returns:
- the ID field
-
hasEditableValues
public static boolean hasEditableValues(DFField field)
Tests if values of the given field can be edited. This method is testing only:- If field's "required" property is AUTO => returns
false - If field has
DFDataEditCapabilityandUPDATEis disabled => returnsfalse - If field's entity has
DFDataEditCapabilityandUPDATEis disabled => returnsfalse
true. This method is not testingDFEntityDataProvider's lockable.- Parameters:
field- field of interest- Returns:
- whether field's value is editable
- If field's "required" property is AUTO => returns
-
-