finding the appropriate capability of the given type.
You can use the utility method findCapability(DFItem,Class)
method instead.
|
Method Summary |
static DFTermExpression |
addNewExpression(DFTermExpression orig,
DFTermExpression expressionToAdd,
DFDataTree dataTree)
|
static boolean |
amIOwner(DFUserItem item)
Test if currently logged user is owner of given object. |
static boolean |
canDestroy(DFItem item)
|
static
|
computeDiff(List<? extends T> arr1,
List<? extends T> arr2)
|
static DFSchema |
connectAutomatically(DFSchemaProvider schemaProvider,
DFFeedback aFeedback)
Automatically goes through schema connect process and returns fully-initialized schema. |
static void |
connectRelationalData(DFRelationship.Direction dir,
Object myID,
Object otherID,
DFEnvironmentRW env)
Connects two rows of related data. |
static boolean |
containsStructuralExpression(DFTermExpression exp)
Detects expressions containing structural sub-expressions |
static List |
convertValuesToCorrectType(DFField field,
List values,
String listName)
Convert the list of values to correct type for the given field. |
static DFDataTree |
createDataTreeForEntity(DFEntity entity,
DFEnvironmentRW env)
Creates a default datatree for the entity. |
static DFEntity |
createSchemaEntity(DFSchema parent,
String entityName,
String entityType,
DFEnvironmentRW env)
A convenience method to create a entity named `entityName' of type `entityType'
in a parent Schema. |
static DFField |
createSchemaField(DFEntity parent,
String fieldName,
String fieldType,
boolean existing,
DFEnvironmentRW env)
A convenience method to create a field named `fieldName' of type `fieldType' in a parent Entity. |
static DFView |
createViewForDataTree(DFDataTree dataTree,
String name,
boolean createOwnUserLock,
DFEnvironmentRW env)
Creates a default view for the datatree. |
static void |
disconnectSchema(DFSchemaProvider schemaProvider)
Disconnect the schema |
static DFEntity |
entityForTable(DFSchema ijcSchema,
String tableName,
boolean onlyPrimary)
Deprecated. |
static DFEntity |
entityForTable(DFSchema ijcSchema,
String dbSchemaName,
String tableName,
boolean onlyPrimary)
Finds an Entity that uses the named table as its storage. |
static DFField |
fieldForColumn(DFEntity entity,
String colName)
Finds a DFField, that uses the named column. |
static DFField |
fieldForColumn(DFSchema ijcSchema,
String tableName,
String colName)
Deprecated. |
static boolean[] |
fieldsToSorts(DFField[] fields,
boolean[] isAscendings)
|
static
|
findAllAppropriateNewTypes(List<DFNewType<T>> allNewTypes,
boolean existingItem,
Class[] requiredCapabilities,
Class[] excludeCapabilities)
Find all the appropriate DFNewType object in the list. |
static Set<DFField> |
findAllFieldsInExpression(DFTermExpression term)
|
static Set<DFEntity> |
findAllTreeEntities(DFDataTree.Vertex vertex)
Collects all entities used in the specified vertex and its children. |
static
|
findAppropriateNewType(List<DFNewType<T>> allNewTypes,
boolean existingItem,
String type)
Find the first the appropriate DFNewType object in the list. |
static
|
findCapability(DFItem item,
Class<T> capabilityClass)
Find the capability which is instance of the given class. |
static DFDataConvertor |
findConvertorFor(Class<? extends DFFieldDataTypeCapability> type)
Return appropriate data convertor for the specified type. |
static DFEntityDataProvider |
findDataProvider(DFResultSet.VertexState vertexState)
Utility method to find the EDP instance. |
static List<DFList> |
findDependentLists(List<DFField> fields)
Find all DFLists depending on given fields. |
static DFRelationship.Direction |
findDirectionFromOrigin(DFRelationship rel,
DFEntity entity)
Finds the relationship direction which originates at entity 'entity'. |
static DFEntity |
findEntityByFieldID(DFContainer<DFEntity> dfContainer,
String fieldId)
Return entity which contains the field with specified ID. |
static DFEntityDataProvider |
findEntityDataProvider(DFEntity entity)
Utility method just doing entity.getSchema().getDataProvider().getEntityDataProvider(entity) |
static DFDataTree.Vertex |
findEntityInDataTree(DFDataTree.Vertex vertex,
DFEntity entity)
Finds a vertex in the DataTree, which corresponds to the given entity. |
static Set<DFField> |
findFieldsUsedInRelationships(DFEntity entity)
Find all fields of specified entity which participate in any relationships. |
static
|
findFirstAppropriateNewType(List<DFNewType<T>> allNewTypes,
boolean existingItem,
Class[] requiredCapabilities,
Class[] excludeCapabilities)
Find the first the appropriate DFNewType object in the list. |
static DBForeignKeyInfo |
findForeignKey(DFSchema ijcSchema,
SchemaQualifiedName fkName)
Finds the named Foreign Key. |
static DBForeignKeyInfo |
findForeignKey(DFSchema ijcSchema,
SchemaQualifiedName table,
String[] columnNames,
DIFUtilities.FKSearchType pkfk)
Finds a foreign key, which references the named columns as its PK or FK
columns, depending on parameters |
static
|
findItemsWithCapability(List<T> items,
Class<C> capabilityClass)
Deprecated. the method was moved to the DFItems.findItemsWithCapability(java.util.List, java.lang.Class) and will be
removed from DIFUtilities in IJC 5.6. |
static
|
findNewTypeWithOptions(List<DFNewType<T>> allNewTypes,
boolean existingItem,
Class optionsClass)
Find the appropriate DFNewType object in the list. |
static DFRelationship.Direction |
findOppositeDirection(DFRelationship.Direction origDir)
Get the opposite direction of the same DFRelationship owner. |
static DFDataTree.Edge |
findRelationshipInDataTree(DFDataTree.Vertex vertex,
DFRelationship rel)
|
static DFSchema |
findSchema(DFItem item)
Utility method finding parent schema for any DFItem type. |
static List<DFTermExpression> |
findSimpleFieldUsagesInQuery(DFTermExpression term,
DFField field)
|
static List<DFRelationship> |
findUsages(DFField field)
Find all relationships where the given field participates. |
static List<DFDataTree.Edge> |
findUsages(DFRelationship rel)
Find all datatrees.edges which are built on top of given relationship. |
static List<DFDataTree.Vertex> |
findUsagesInDataTrees(DFEntity entity)
Find all datatrees.vertexes which are built on top of given entity. |
static List<DFRelationship> |
findUsagesInRelationships(DFEntity entity)
Find all relationships where the given entity participates. |
static List<Comparable<?>> |
getAllIDsOfEntityFor(DFResultSet.VertexState vs)
Get all IDs (primary key values) of the entity that
belongs to the vertex for the given DFResultSet.VertexState. |
static String |
getDefaultSchemaName(DFSchema schema)
|
static String |
getExtraProperty(DFItem item,
Class<? extends ExtraDFItemProperty> extraProp)
Deprecated. Use getExtraProperty(DFItem item, Class extends ExtraDFItemProperty> extraProp) |
static Collection<DBForeignKeyInfo> |
getForeignKeys(DFSchema ijcSchema)
Collects are FKs defined in the database schema, regardless of whether
the FK is mapped to a Relationship or not. |
static String |
getIJCUsername(DFSchema schema)
Get the username of the IJC user or null if the user has not yet logged in. |
static DFLockable |
getLockable(DBFieldCapability.DBColumn item)
|
static DFLockable |
getLockable(DFDataTree item,
boolean forViewsOrQueries)
Find lockable for datatree. |
static DFLockable |
getLockable(DFEntity item)
|
static DFLockable |
getLockable(DFEntity item,
boolean forLists)
|
static DFLockable |
getLockable(DFEntityDataProvider item)
|
static DFLockable |
getLockable(DFField item)
|
static DFLockable |
getLockable(DFList item)
|
static DFLockable |
getLockable(DFQuery item)
|
static DFLockable |
getLockable(DFRelationDataProvider item)
|
static DFLockable |
getLockable(DFRelationship rel)
|
static DFLockable |
getLockable(DFResultSet.VertexState item)
|
static DFLockable |
getLockable(DFResultSet item)
|
static DFLockable |
getLockable(DFSchema item)
|
static DFLockable |
getLockable(DFScript item)
|
static DFLockable |
getLockable(DFView item)
|
static DFLockable |
getLockable(Object item)
Find the lockable for any object (DFItem or DFResultSet). |
static DFRelationship.Direction |
getOutgoingDirection(DFEntity entity,
DFRelationship rel)
|
static String |
getOwnerUsername(DFUserItem item)
Try to find username of owner of given object. |
static
|
getSortedItems(DFContainer<T> container)
Deprecated. highly specialized (had one known usage) method. Will be removed from API in IJC 5.6. |
static
|
getSortedItemsAlphabetically(DFContainer<T> container)
Deprecated. the method was moved to the DFItems.alphabeticallySortedCopy(java.util.List) and will be
removed from DIFUtilities in IJC 5.6. |
static boolean |
isEntityDataEditable(DFEntity entity,
DFDataEditCapability.Type type)
|
static boolean |
isExpressionStructural(DFTermExpression exp)
Detects structural expressions |
static boolean |
isFieldValueEditable(DFField field)
Tests if fields value can be edited. |
static boolean |
isMultiple(DFRelationship.Direction dir)
Determines, if the relationship end has 'multiple' cardinality. |
static Object |
registerListenerToDataTree(DFDataTree dt,
PropertyChangeListener pcl)
Register listener to the datatree as well as to all its vertexes, entities and their fields. |
static void |
registerWhenSchemaReady(DFSchemaProvider schemaProvider,
DIFUtilities.SchemaReadyRunnable schemaReadyListener)
Register to schema provider to be notified about schema providers status changes. |
static DFTermExpression |
removeSubExpression(DFTermExpression orig,
DFTermExpression expressionToRemove)
|
static DFTermExpression |
replaceSubExpression(DFTermExpression expr,
DFTermExpression whatToReplace,
DFTermExpression replaceWith)
|
static boolean |
safeEqualsIgnoreCase(String s1,
String s2)
|
static boolean |
safeEqualsLists(List<String> list1,
List<String> list2)
|
static DFEntityDataListener |
weakEntityDataListener(DFEntityDataListener l,
DFEntityDataProvider source)
Creates a weak implementation of DFEntityDataListener. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
USER_UNKNOWN
public static final String USER_UNKNOWN
UPDATE_DESCRIPTORS_RECOMMENDED_LIMIT
public static final int UPDATE_DESCRIPTORS_RECOMMENDED_LIMIT
- This constant represents a little fuzzy limit for number of updates for method
DFEntityDataProvider.update(List, DFUndoConfig, DFEnvironmentRW).
See this method documentation for more details. Current value of the constant is 250.
- See Also:
- Constant Field Values
DIFUtilities
public DIFUtilities()
findCapability
public static <T extends DFCapability> T findCapability(DFItem item,
Class<T> capabilityClass)
- Find the capability which is instance of the given class.
- Parameters:
item - The DFItem where we are asking for the capabilitycapabilityClass - The required class of the capability
- Returns:
- The first capability which is instance of the required type or
null
if there is no such a capability
findItemsWithCapability
@Deprecated
public static <T extends DFItem,C extends DFCapability> List<T> findItemsWithCapability(List<T> items,
Class<C> capabilityClass)
- Deprecated. the method was moved to the
DFItems.findItemsWithCapability(java.util.List, java.lang.Class) and will be
removed from DIFUtilities in IJC 5.6.
- Filter the specified items so that only those with the specified capability are returned.
- Parameters:
items - The items to look atcapabilityClass - The required capability
- Returns:
- The items with that capability
findNewTypeWithOptions
public static <T extends DFItem> DFNewType<T> findNewTypeWithOptions(List<DFNewType<T>> allNewTypes,
boolean existingItem,
Class optionsClass)
- Find the appropriate DFNewType object in the list. Use this method if you are looking for a specific
newtype among all newtypes provided by
DFContainer.
- Parameters:
allNewTypes - The original list of newtypesexistingItem - The flag if newtype should be creating new objects or just promote
the existing artefacts to a new DFItemoptionsClass - The required type of options object provided by a DFNewType
- Returns:
- The first appropriate DFNewType or null.
findAllAppropriateNewTypes
public static <T extends DFItem> List<DFNewType<T>> findAllAppropriateNewTypes(List<DFNewType<T>> allNewTypes,
boolean existingItem,
Class[] requiredCapabilities,
Class[] excludeCapabilities)
- Find all the appropriate DFNewType object in the list. Use this method if you are looking for a specific
newtype among all newtypes provided by
DFContainer.
- Parameters:
allNewTypes - The original list of newtypesexistingItem - The flag if newtype should be creating new objects or just promote
the existing artefacts to a new DFItemrequiredCapabilities - The required types (all must be included)excludeCapabilities - The required types (none of these can be included)
- Returns:
- All appropriate DFNewTypes or empty list (never returns null).
findFirstAppropriateNewType
public static <T extends DFItem> DFNewType<T> findFirstAppropriateNewType(List<DFNewType<T>> allNewTypes,
boolean existingItem,
Class[] requiredCapabilities,
Class[] excludeCapabilities)
- Find the first the appropriate DFNewType object in the list. Use this method if you are looking for a specific
newtype among all newtypes provided by
DFContainer.
- Parameters:
allNewTypes - The original list of newtypesexistingItem - The flag if newtype should be creating new objects or just promote
the existing artefacts to a new DFItemrequiredCapabilities - The required types (all must be included)excludeCapabilities - The required types (none of these can be included)
- Returns:
- The first appropriate DFNewType or null.
findAppropriateNewType
public static <T extends DFItem> DFNewType<T> findAppropriateNewType(List<DFNewType<T>> allNewTypes,
boolean existingItem,
String type)
- Find the first the appropriate DFNewType object in the list. Use this method if you are looking for a specific
implementation type. Use this method very carefully. It is usually better to find the newtype using
required DFCapabilities instead of looking for specific implementation type.
- Parameters:
allNewTypes - The original list of newtypesexistingItem - The flag if newtype should be creating new objects or just promote
the existing artefacts to a new DFItemtype - The required DFItem implementation type
- Returns:
- The first appropriate DFNewType or null.
findConvertorFor
public static DFDataConvertor findConvertorFor(Class<? extends DFFieldDataTypeCapability> type)
- Return appropriate data convertor for the specified type. Can return null
if there is no such convertor registered.
- Parameters:
type - The requested data type.
- Returns:
- The convertor or null
createSchemaField
public static DFField createSchemaField(DFEntity parent,
String fieldName,
String fieldType,
boolean existing,
DFEnvironmentRW env)
- A convenience method to create a field named `fieldName' of type `fieldType' in a parent Entity.
The method uses
DFNewType to look up appropriate code that creates the field. If the DFNewType
cannot be found, the method throws UnsupportedOperationException. If the new type does not support
the required options, it will throw IllegalArgumentException for the requested field type.
- Parameters:
parent - The parent EntityfieldName - The n ame for the new fieldfieldType - The t ype for the new field (DBImplConstants.FIELD_xxx)existing - True, if a DFField for an existing storage object should be created, false, if storage
artifacts should be created alongenv - The e xecution environment.
- Returns:
- The instance of new field
createSchemaEntity
public static DFEntity createSchemaEntity(DFSchema parent,
String entityName,
String entityType,
DFEnvironmentRW env)
- A convenience method to create a entity named `entityName' of type `entityType'
in a parent Schema. If the name is already used by a different entity, the next available name will be used instead.
The method uses
DFNewType to look up appropriate code that creates the entity. If the DFNewType
cannot be found, the method throws UnsupportedOperationException. If the new type does not support
the required options, it will throw IllegalArgumentException for the requested entity type.
- Parameters:
parent - The parent schemaentityName - The n ame for the new entityentityType - The t ype for the new entityenv - The e xecution environment.
- Returns:
- The instance of new entity
createDataTreeForEntity
public static DFDataTree createDataTreeForEntity(DFEntity entity,
DFEnvironmentRW env)
- Creates a default datatree for the entity. This method is using standard DFNewType approach.
createViewForDataTree
public static DFView createViewForDataTree(DFDataTree dataTree,
String name,
boolean createOwnUserLock,
DFEnvironmentRW env)
- Creates a default view for the datatree. This method is using standard DFNewType approach.
- Parameters:
dataTree - The source datatreename - Can be null - then defaultName is usedcreateOwnUserLock - If false the lock from environment will be used for adding new view. If false the Views lock will
be obtained from DFSchema.getUserLockable().
findEntityDataProvider
public static DFEntityDataProvider findEntityDataProvider(DFEntity entity)
- Utility method just doing
entity.getSchema().getDataProvider().getEntityDataProvider(entity)
findSchema
public static DFSchema findSchema(DFItem item)
- Utility method finding parent schema for any DFItem type.
fieldsToSorts
public static boolean[] fieldsToSorts(DFField[] fields,
boolean[] isAscendings)
canDestroy
public static boolean canDestroy(DFItem item)
- Returns:
- True, if the item can be destroyed and removed from the parent
getSortedItems
@Deprecated
public static <T extends DFItem> List<T> getSortedItems(DFContainer<T> container)
- Deprecated. highly specialized (had one known usage) method. Will be removed from API in IJC 5.6.
- Sort DFItems by their IDs.
getSortedItemsAlphabetically
@Deprecated
public static <T extends DFItem> List<T> getSortedItemsAlphabetically(DFContainer<T> container)
- Deprecated. the method was moved to the
DFItems.alphabeticallySortedCopy(java.util.List) and will be
removed from DIFUtilities in IJC 5.6.
safeEqualsIgnoreCase
public static boolean safeEqualsIgnoreCase(String s1,
String s2)
safeEqualsLists
public static boolean safeEqualsLists(List<String> list1,
List<String> list2)
findDataProvider
public static DFEntityDataProvider findDataProvider(DFResultSet.VertexState vertexState)
- Utility method to find the EDP instance.
getOwnerUsername
public static String getOwnerUsername(DFUserItem item)
- Try to find username of owner of given object. If the object has
DFSharedObjectCapability it returns the name of user from this interface.
Otherwise returns constant representing unknown user: USER_UNKNOWN (you can use == operator to test it).
- Parameters:
item - Tested item
- Returns:
- The username of owner if it's possible to determine, otherwise magical constant
USER_UNKNOWN.
Never returns null.
amIOwner
public static boolean amIOwner(DFUserItem item)
- Test if currently logged user is owner of given object. If it's not possible to determine it, it expects
user IS owner. The current user is obtained from item's schema from
IJCUserLoginService.
If this capability is not present, then it also expects the current user is only one in the system and
so also owner of all objects.
- Parameters:
item - Tested item
- Returns:
- False if currently logged user is NOT owner of item, otherwise true.
getLockable
public static DFLockable getLockable(Object item)
- Find the lockable for any object (DFItem or DFResultSet).
If you are looking for views' lockable use
getLockable(DFDataTree, boolean) instead.
getLockable
public static DFLockable getLockable(DFDataTree item,
boolean forViewsOrQueries)
- Find lockable for datatree.
- Parameters:
item - The datatreeforViewsOrQueries - If true User lockable is returned, otherwise it returns standard schema DDL lockable
getLockable
public static DFLockable getLockable(DFView item)
getLockable
public static DFLockable getLockable(DFList item)
getLockable
public static DFLockable getLockable(DFQuery item)
getLockable
public static DFLockable getLockable(DFScript item)
getLockable
public static DFLockable getLockable(DFSchema item)
getLockable
public static DFLockable getLockable(DFResultSet.VertexState item)
getLockable
public static DFLockable getLockable(DFEntity item)
getLockable
public static DFLockable getLockable(DFEntity item,
boolean forLists)
getLockable
public static DFLockable getLockable(DFField item)
getLockable
public static DFLockable getLockable(DFResultSet item)
getLockable
public static DFLockable getLockable(DFEntityDataProvider item)
getLockable
public static DFLockable getLockable(DFRelationDataProvider item)
getLockable
public static DFLockable getLockable(DBFieldCapability.DBColumn item)
getLockable
public static DFLockable getLockable(DFRelationship rel)
weakEntityDataListener
public static DFEntityDataListener weakEntityDataListener(DFEntityDataListener l,
DFEntityDataProvider source)
- Creates a weak implementation of DFEntityDataListener.
- Parameters:
l - The listener to delegate tosource - The source that the listener should detach from when
listener l is freed, can be null
- Returns:
- A ChangeListener delegating to
l.
findUsages
public static List<DFRelationship> findUsages(DFField field)
- Find all relationships where the given field participates.
All these relationships must be also removed when deleting field.
findDependentLists
public static List<DFList> findDependentLists(List<DFField> fields)
- Find all DFLists depending on given fields.
All these DFLists must be also deleted when deleting field
findOppositeDirection
public static DFRelationship.Direction findOppositeDirection(DFRelationship.Direction origDir)
- Get the opposite direction of the same DFRelationship owner.
findDirectionFromOrigin
public static DFRelationship.Direction findDirectionFromOrigin(DFRelationship rel,
DFEntity entity)
- Finds the relationship direction which originates at entity 'entity'.
If the entity is neither source or destination of 'rel', an
IllegalArgumentException
is thrown.
- Parameters:
rel - The r elationship of interestentity - The direction's originating entity
- Returns:
- The direction, that originates on 'entity'.
findUsages
public static List<DFDataTree.Edge> findUsages(DFRelationship rel)
- Find all datatrees.edges which are built on top of given relationship.
All these edges must be removed when deleting relationship.
findRelationshipInDataTree
public static DFDataTree.Edge findRelationshipInDataTree(DFDataTree.Vertex vertex,
DFRelationship rel)
findUsagesInDataTrees
public static List<DFDataTree.Vertex> findUsagesInDataTrees(DFEntity entity)
- Find all datatrees.vertexes which are built on top of given entity.
All these edges must be removed when deleting relationship.
findEntityInDataTree
public static DFDataTree.Vertex findEntityInDataTree(DFDataTree.Vertex vertex,
DFEntity entity)
- Finds a vertex in the DataTree, which corresponds to the given entity. The
search starts at the specified vertex (e.g.
DFDataTree.getRootVertex()).
- Parameters:
vertex - The r oot of the searchentity - The e ntity to find
- Returns:
- The Vertex that corresponds to the given entity or null, if the entity
does not have a Vertex in the subtree.
findAllTreeEntities
public static Set<DFEntity> findAllTreeEntities(DFDataTree.Vertex vertex)
- Collects all entities used in the specified vertex and its children.
The set will always contain at least the vertex' own entity. The returned
Set is a private copy and can be changed.
- Parameters:
vertex - The root from where Entities should be collected
- Returns:
- The set of entities found.
findUsagesInRelationships
public static List<DFRelationship> findUsagesInRelationships(DFEntity entity)
- Find all relationships where the given entity participates.
All these relationships must be also removed when deleting entity.
findFieldsUsedInRelationships
public static Set<DFField> findFieldsUsedInRelationships(DFEntity entity)
- Find all fields of specified entity which participate in any relationships.
- Parameters:
entity - The entity which is searched.
- Returns:
- The list of entity's fields participating in any relationship.
findAllFieldsInExpression
public static Set<DFField> findAllFieldsInExpression(DFTermExpression term)
findSimpleFieldUsagesInQuery
public static List<DFTermExpression> findSimpleFieldUsagesInQuery(DFTermExpression term,
DFField field)
replaceSubExpression
public static DFTermExpression replaceSubExpression(DFTermExpression expr,
DFTermExpression whatToReplace,
DFTermExpression replaceWith)
addNewExpression
public static DFTermExpression addNewExpression(DFTermExpression orig,
DFTermExpression expressionToAdd,
DFDataTree dataTree)
removeSubExpression
public static DFTermExpression removeSubExpression(DFTermExpression orig,
DFTermExpression expressionToRemove)
connectAutomatically
public static DFSchema connectAutomatically(DFSchemaProvider schemaProvider,
DFFeedback aFeedback)
- Automatically goes through schema connect process and returns fully-initialized schema.
Never asks user (username, password, etc.). If any information is missing and schema
can't be initialized without interaction with user then it just closes it and returns null.
Make sure all information necessary for schema init are written in ijs schema properties.
- Parameters:
schemaProvider - aFeedback -
- Returns:
- The fully-initialized schema
disconnectSchema
public static void disconnectSchema(DFSchemaProvider schemaProvider)
- Disconnect the schema
- Parameters:
schemaProvider -
registerWhenSchemaReady
public static void registerWhenSchemaReady(DFSchemaProvider schemaProvider,
DIFUtilities.SchemaReadyRunnable schemaReadyListener)
- Register to schema provider to be notified about schema providers status changes. The main reason of this
method is to be notified when schema is ready, but it can be used to listen to all status changes.
Important note: schemaReadyListener is registered to DFSchemaProvider weakly, so you must hold your reference to
this schemaReadyListener. Otherwise it's unregistered and you will never be notified.
This method immediately invokes (on the same thread) the status change for the current status of the schema provider
and so schemaReady method is invoked too if schema is currently already prepared.
The preferred usage is something like:
mySchemaReadyListener = new DIFUtilities.SchemaReadyRunnable() {
public void schemaReady(DFSchemaProvider schemaProvider, DFSchema schema) {
doSomething(schema);
// if you do not care about future changes of schema provider status (e.g. disconnect) then forgot reference to this object:
// mySchemaReadyListener = null;
}
};
DIFUtilities.registerWhenSchemaReady(schemaProvider, mySchemaReadyListener);
registerListenerToDataTree
public static Object registerListenerToDataTree(DFDataTree dt,
PropertyChangeListener pcl)
- Register listener to the datatree as well as to all its vertexes, entities and their fields.
Property change events are fired with correct source, so you can recognize the origin of the event.
The listener is automatically added to newly created fields or vertexes. The listener is registered
using weak listeners and is automatically removed from all objects when it's not necessary.
When register to datatree, you must keep the hard reference to the returned object. When the reference
is released the listener is unregistered from all objects and you won't receive any future event; actually
some more events can be fired, but it should stop firing them very shortly when next garbage collection
is executed.
- Parameters:
dt - The datatree you want to listen to changespcl - The propery change listener to be invoked when any change is fired
- Returns:
- Keep this reference as long as you want to recieve property change events.
isMultiple
public static boolean isMultiple(DFRelationship.Direction dir)
- Determines, if the relationship end has 'multiple' cardinality. That is,
multiple rows of 'src' entity may refer to a single 'dst' entity's row
- Parameters:
dir - The direction to test
- Returns:
- True, if the 'src' endpoint has multiple cardinality.
connectRelationalData
public static void connectRelationalData(DFRelationship.Direction dir,
Object myID,
Object otherID,
DFEnvironmentRW env)
throws DFRelationDataException
- Connects two rows of related data. This helper works around the ambivalence of
DFRelationDataProvider's addRelation() and removeRelation() and swaps the IDs
as appropriate.
- Parameters:
myID - ID at 'this' end of the relation (value of source field of the 'dir' direction)otherID - ID at the 'other' end of the relationdir - The r elationship direction
- Throws:
DFRelationDataException
getOutgoingDirection
public static DFRelationship.Direction getOutgoingDirection(DFEntity entity,
DFRelationship rel)
getForeignKeys
public static Collection<DBForeignKeyInfo> getForeignKeys(DFSchema ijcSchema)
- Collects are FKs defined in the database schema, regardless of whether
the FK is mapped to a Relationship or not. Returns empty collection, if
the schema has no DB capability.
- Parameters:
ijcSchema - The IJC schema
- Returns:
- The collection of DFForeignKeyInfo instances.
findForeignKey
public static DBForeignKeyInfo findForeignKey(DFSchema ijcSchema,
SchemaQualifiedName fkName)
- Finds the named Foreign Key. Names are case-insensitive. Returns null,
if the key is not found, or the schema has no DB capability.
- Parameters:
ijcSchema - The IJC schemafkName - The name of the key
- Returns:
- DFForeignKey instance, or null if the name is not found.
findForeignKey
public static DBForeignKeyInfo findForeignKey(DFSchema ijcSchema,
SchemaQualifiedName table,
String[] columnNames,
DIFUtilities.FKSearchType pkfk)
- Finds a foreign key, which references the named columns as its PK or FK
columns, depending on parameters
- Parameters:
table - The t able nameijcSchema - The parent IJC schemacolumnNames - The c olumn names for the FK
- Returns:
- The foreign key if found, or null
fieldForColumn
public static DFField fieldForColumn(DFEntity entity,
String colName)
- Finds a
DFField, that uses the named column. Returns first such
DFField, or null, if the column is not used in any DFField.
- Parameters:
entity - The parent of the DFFieldcolName - The n ame of the underlying DB column
- Returns:
- The DFField or null.
fieldForColumn
@Deprecated
public static DFField fieldForColumn(DFSchema ijcSchema,
String tableName,
String colName)
- Deprecated.
- A convenience method that finds DFField which uses the named column
in the named table.
- Parameters:
ijcSchema - The p arent IJC schematableName - The t able namecolName - The c olumn name
- Returns:
- The DFField which uses the field or null if none is found.s
entityForTable
@Deprecated
public static DFEntity entityForTable(DFSchema ijcSchema,
String tableName,
boolean onlyPrimary)
- Deprecated.
- Finds an Entity that uses the named table as its storage. If onyPrimary
is true, the table must be the primary data table for the entity
(returned from
DBEntityCapability.getTableName()). If onlyPrimary
is false, the entity is matched if the tableName is used by the entity in
any way - e.g. the _UL tables for JChem Entities.
- Parameters:
ijcSchema - The parent IJC schematableName - The table name (simple table name - default schema, or schema.table format)onlyPrimary - If true, matches only primary tables of entities
- Returns:
- The DFEntity for the specified table
entityForTable
public static DFEntity entityForTable(DFSchema ijcSchema,
String dbSchemaName,
String tableName,
boolean onlyPrimary)
- Finds an Entity that uses the named table as its storage. If onyPrimary
is true, the table must be the primary data table for the entity
(returned from
DBEntityCapability.getTableName()). If onlyPrimary
is false, the entity is matched if the tableName is used by the entity in
any way - e.g. the _UL tables for JChem Entities.
- Parameters:
ijcSchema - The parent IJC schemadbSchemaName - The d atabase schema nametableName - The simple table nameonlyPrimary - If true, matches only primary tables of entities
- Returns:
- The DFEntity for the specified table
isFieldValueEditable
public static boolean isFieldValueEditable(DFField field)
- Tests if fields value can be edited. This method is testing only:
- If Field's "required" property is AUTO => returns false
- If Field has DFDataEditCapability and UPDATE is disabled => returns false
- If Field's entity has DFDataEditCapability and UPDATE is disabled => returns false
Otherwise returns true. This method is not testing DFEntityDataProvider's Lockable.
isEntityDataEditable
public static boolean isEntityDataEditable(DFEntity entity,
DFDataEditCapability.Type type)
convertValuesToCorrectType
public static List convertValuesToCorrectType(DFField field,
List values,
String listName)
- Convert the list of values to correct type for the given field. For example when list
containing just String instances is passed to this method with Integer field type,
it returns the list where all objects will be Integer. Convertor's options are currently ignored.
When conversion throws exception (it's not possible to convert the value), it's ignored, only
info message is printed to log (listName parameter is used for this message).
- Parameters:
field - This field is asked for convertorvalues - Values to be convertedlistName - List name is only used when reporting errors in conversion to log
- Returns:
- The list of values in correct type.
findEntityByFieldID
public static DFEntity findEntityByFieldID(DFContainer<DFEntity> dfContainer,
String fieldId)
- Return entity which contains the field with specified ID.
- Parameters:
dfContainer - The entity DFContainerfieldId - The fieldId
- Returns:
- The entity or null (if not found)
getExtraProperty
@Deprecated
public static String getExtraProperty(DFItem item,
Class<? extends ExtraDFItemProperty> extraProp)
- Deprecated. Use
getExtraProperty(DFItem item, Class extends ExtraDFItemProperty> extraProp)
- Utility method for getting value for extra property.
- Parameters:
extraProp - The property typeitem - The entity or field
- Returns:
- Null if the property is not
getIJCUsername
public static String getIJCUsername(DFSchema schema)
- Get the username of the IJC user or null if the user has not yet logged in.
- Returns:
- The name of the current user. e.g. "admin"
computeDiff
public static <T> List<T>[] computeDiff(List<? extends T> arr1,
List<? extends T> arr2)
getDefaultSchemaName
public static String getDefaultSchemaName(DFSchema schema)
getAllIDsOfEntityFor
public static List<Comparable<?>> getAllIDsOfEntityFor(DFResultSet.VertexState vs)
- Get all IDs (primary key values) of the
entity that
belongs to the vertex for the given DFResultSet.VertexState.
- Parameters:
vs - DFResultSet.VertexState from which the entity is obtained
- Returns:
- the all IDs
isExpressionStructural
public static boolean isExpressionStructural(DFTermExpression exp)
- Detects structural expressions
- Parameters:
exp - tested expression
- Returns:
- true if expression is a structural expression
containsStructuralExpression
public static boolean containsStructuralExpression(DFTermExpression exp)
- Detects expressions containing structural sub-expressions
- Parameters:
exp - tested expression
- Returns:
- true this expression or