Project Wonder 5.0

er.extensions.eof
Class ERXEOAccessUtilities

java.lang.Object
  extended by er.extensions.eof.ERXEOAccessUtilities

public class ERXEOAccessUtilities
extends java.lang.Object

Collection of EOAccess related utilities. EOAccess provides the data access mechanisms for the Enterprise Objects technology.


Nested Class Summary
static interface ERXEOAccessUtilities.AdaptorChannelOperation<T>
          Implemented by any adaptor channel operation that needs to run with an open adaptor channel.
static class ERXEOAccessUtilities.ChannelAction
          Deals with the nitty-gritty of direct row manipulation by correctly opening, closing, locking and unlocking the needed EOF objects for direct row manipulation.
static interface ERXEOAccessUtilities.DatabaseContextOperation<T>
          Implemented by any database operation that needs to run inside of a database context lock.
 
Field Summary
static org.apache.log4j.Logger log
          logging support
 
Constructor Summary
ERXEOAccessUtilities()
           
 
Method Summary
static com.webobjects.foundation.NSArray attributePathForKeyPath(com.webobjects.eoaccess.EOEntity entity, java.lang.String keyPath)
          Creates an array of relationships and attributes from the given keypath to give to the EOSQLExpression method sqlStringForAttributePath.
static com.webobjects.eoaccess.EOAttribute attributeWithColumnNameFromEntity(java.lang.String columnName, com.webobjects.eoaccess.EOEntity entity)
           
static void batchFetchRelationship(com.webobjects.eoaccess.EODatabaseContext databaseContext, com.webobjects.eoaccess.EORelationship relationship, com.webobjects.foundation.NSArray objects, com.webobjects.eocontrol.EOEditingContext editingContext, boolean skipFaultedRelationships)
          Batch fetch a relationship, optionally skipping any relationship that has already faulted in its to-many relationship.
static void batchFetchRelationship(com.webobjects.eoaccess.EODatabaseContext databaseContext, java.lang.String entityName, java.lang.String relationshipName, com.webobjects.foundation.NSArray objects, com.webobjects.eocontrol.EOEditingContext editingContext, boolean skipFaultedRelationships)
          Batch fetch a relationship, optionally skipping any relationship that has already faulted in its to-many relationship.
static com.webobjects.foundation.NSArray classPropertiesNotInParent(com.webobjects.eoaccess.EOEntity entity, boolean includeAttributes, boolean includeToOneRelationships, boolean includeToManyRelationships)
           
static boolean closeDatabaseConnections(com.webobjects.eocontrol.EOObjectStoreCoordinator osc)
          Closes the (JDBC) Connection from all database channels for the specified EOObjectStoreCoordinator
static com.webobjects.eoaccess.EOAttribute createAggregateAttribute(com.webobjects.eocontrol.EOEditingContext ec, java.lang.String function, java.lang.String attributeName, java.lang.String entityName)
          Creates an aggregate integer attribute for a given function name.
static com.webobjects.eoaccess.EOAttribute createAggregateAttribute(com.webobjects.eocontrol.EOEditingContext ec, java.lang.String function, java.lang.String attributeName, java.lang.String entityName, java.lang.Class valueClass, java.lang.String valueType)
          Creates an aggregate attribute for a given function name.
static com.webobjects.eoaccess.EOAttribute createAggregateAttribute(com.webobjects.eocontrol.EOEditingContext ec, java.lang.String function, java.lang.String attributeName, java.lang.String entityName, java.lang.Class valueClass, java.lang.String valueType, java.lang.String aggregateName)
          Creates an aggregate attribute for a given function name.
static com.webobjects.eoaccess.EOAttribute createAggregateAttribute(com.webobjects.eocontrol.EOEditingContext ec, java.lang.String function, java.lang.String attributeName, java.lang.String entityName, java.lang.Class valueClass, java.lang.String valueType, java.lang.String aggregateName, java.lang.String entityTableAlias)
          Creates an aggregate attribute for a given function name.
static com.webobjects.eoaccess.EORelationship createFlattenedRelationship(java.lang.String relationshipName, java.lang.String sourceEntityName, java.lang.String definition, int deleteRule, boolean isMandatory, boolean isClassProperty)
          Programatically adds a flattened relationship to an entity at runtime.
static java.lang.String createIndexSQLForEntities(com.webobjects.foundation.NSArray entities)
          Deprecated.  
static java.lang.String createIndexSQLForEntities(com.webobjects.foundation.NSArray entities, com.webobjects.foundation.NSArray externalTypesToIgnore)
          Deprecated.  
static java.lang.String createIndexSQLForEntitiesForOracle(com.webobjects.foundation.NSArray entities)
          Deprecated.  
static java.lang.String createLogString(com.webobjects.eoaccess.EOAdaptorChannel channel, com.webobjects.eoaccess.EOSQLExpression expression, long millisecondsNeeded)
           
static com.webobjects.eoaccess.EORelationship createRelationship(java.lang.String relationshipName, java.lang.String sourceEntityName, java.lang.String sourceAttributeName, java.lang.String destinationEntityName, java.lang.String destinationAttributeName, boolean toMany, int deleteRule, boolean isMandatory, boolean isClassProperty, boolean shouldPropagatePrimaryKey)
          Programatically adds a toOne or toMany relationship to an entity at runtime.
static java.lang.String createSchemaSQLForEntitiesInDatabaseContext(com.webobjects.foundation.NSArray entities, com.webobjects.eoaccess.EODatabaseContext databaseContext, boolean create, boolean drop)
          Deprecated.  
static java.lang.String createSchemaSQLForEntitiesInModelWithName(com.webobjects.foundation.NSArray entities, java.lang.String modelName)
          Deprecated.  
static java.lang.String createSchemaSQLForEntitiesInModelWithNameAndOptions(com.webobjects.foundation.NSArray entities, java.lang.String modelName, com.webobjects.foundation.NSDictionary optionsCreate)
          Deprecated.  
static java.lang.String createSchemaSQLForEntitiesInModelWithNameAndOptionsForOracle9(com.webobjects.foundation.NSArray entities, java.lang.String modelName, com.webobjects.foundation.NSDictionary optionsCreate)
          oracle 9 has a maximum length of 30 characters for table names, column names and constraint names Foreign key constraint names are defined like this from the plugin:

TABLENAME_FOEREIGNKEYNAME_FK

The whole statement looks like this:

ALTER TABLE [TABLENAME] ADD CONSTRAINT [CONSTRAINTNAME] FOREIGN KEY ([FK]) REFERENCES [DESTINATION_TABLE] ([PK]) DEFERRABLE INITIALLY DEFERRED THIS means that the tablename and the columnname together cannot be longer than 26 characters.

This method checks each foreign key constraint name and if it is longer than 30 characters its replaced with a unique name.
static java.lang.String createSchemaSQLForEntitiesWithOptions(com.webobjects.foundation.NSArray entities, com.webobjects.eoaccess.EODatabaseContext databaseContext, com.webobjects.foundation.NSDictionary optionsCreate)
          Deprecated.  
static com.webobjects.eoaccess.EODatabaseContext databaseContextForEntityNamed(com.webobjects.eocontrol.EOObjectStoreCoordinator osc, java.lang.String entityName)
          Returns the database context for the given entity in the given EOObjectStoreCoordinator
static com.webobjects.eoaccess.EODatabaseContext databaseContextForObject(com.webobjects.eocontrol.EOEnterpriseObject eo)
          Returns the database context for an EO.
static int deleteRowsDescribedByQualifier(com.webobjects.eocontrol.EOEditingContext ec, java.lang.String entityName, com.webobjects.eocontrol.EOQualifier qualifier)
          Deletes rows described by the qualifier.
static com.webobjects.eoaccess.EOEntity destinationEntityForKeyPath(com.webobjects.eoaccess.EOEntity entity, java.lang.String keyPath)
           
static com.webobjects.eoaccess.EOEntity entityForEo(com.webobjects.eocontrol.EOEnterpriseObject eo)
          Returns the EOEntity for the provided EOEnterpriseObject if one exists
static com.webobjects.foundation.NSArray<com.webobjects.eoaccess.EOEntity> entityHierarchyForEntity(com.webobjects.eocontrol.EOEditingContext ec, com.webobjects.eoaccess.EOEntity rootEntity)
           
static com.webobjects.foundation.NSArray<java.lang.String> entityHierarchyNamesForEntityNamed(com.webobjects.eocontrol.EOEditingContext ec, java.lang.String rootEntityName)
           
static com.webobjects.eoaccess.EOEntity entityMatchingString(com.webobjects.eocontrol.EOEditingContext ec, java.lang.String string)
          Finds an entity that is contained in a string.
static com.webobjects.eoaccess.EOEntity entityNamed(com.webobjects.eocontrol.EOEditingContext ec, java.lang.String entityName)
          Similar to the helper in EOUtilities, but allows for null editingContext.
static boolean entityUsesSeparateTable(com.webobjects.eoaccess.EOEntity entity)
           
static com.webobjects.eoaccess.EOEntity entityUsingTable(com.webobjects.eocontrol.EOEditingContext ec, java.lang.String tableName)
          Finds an entity that is associated with the table name.
static boolean entityWithNamedIsShared(com.webobjects.eocontrol.EOEditingContext ec, java.lang.String entityName)
          Method used to determine if a given entity is a shared entity.
static void evaluateSQLWithEntity(com.webobjects.eocontrol.EOEditingContext ec, com.webobjects.eoaccess.EOEntity entity, java.lang.String exp)
          Utility method used to execute arbitrary SQL.
static void evaluateSQLWithEntityNamed(com.webobjects.eocontrol.EOEditingContext ec, java.lang.String entityName, java.lang.String exp)
          Utility method used to execute arbitrary SQL.
static
<T> T
executeAdaptorChannelOperation(com.webobjects.eoaccess.EODatabaseContext databaseContext, int maxAttempts, ERXEOAccessUtilities.AdaptorChannelOperation<T> operation)
          Executes the given adaptor channel operation within a database context lock and with a requested open channel, retrying up to maxRetryCount times if the database connection dropped.
static
<T> T
executeAdaptorChannelOperation(java.lang.String modelName, int maxAttempts, ERXEOAccessUtilities.AdaptorChannelOperation<T> operation)
          Executes the given adaptor channel operation within a database context lock and with a requested open channel, retrying up to maxRetryCount times if the database connection dropped.
static
<T> T
executeDatabaseContextOperation(com.webobjects.eoaccess.EODatabaseContext databaseContext, int maxAttempts, ERXEOAccessUtilities.DatabaseContextOperation<T> operation)
          Executes the given database context operation within a database context lock, retrying up to maxRetryCount times if the database connection dropped.
static com.webobjects.foundation.NSArray externalNamesForEntity(com.webobjects.eoaccess.EOEntity entity, boolean includeParentEntities)
           
static com.webobjects.foundation.NSArray externalNamesForEntityNamed(java.lang.String entityName, boolean includeParentEntities)
           
static java.lang.Number getNextValFromSequenceNamed(com.webobjects.eocontrol.EOEditingContext ec, java.lang.String modelName, java.lang.String sequenceName)
          Deprecated.  
static java.lang.String guessPluginName(com.webobjects.eoaccess.EOModel model)
          Tries to get the plugin name for a JDBC based model.
static java.lang.String guessPluginNameForConnectionDictionary(com.webobjects.foundation.NSDictionary connectionDictionary)
          Tries to get the plugin name for a connection dictionary.
static int insertRow(com.webobjects.eocontrol.EOEditingContext ec, java.lang.String entityName, com.webobjects.foundation.NSDictionary newValues)
          Insert row described dictionary.
static int insertRows(com.webobjects.eocontrol.EOEditingContext ec, java.lang.String entityName, java.util.Collection<? extends com.webobjects.foundation.NSDictionary<java.lang.String,?>> newValues)
          Insert rows described the array of dictionaries.
static boolean isOptimisticLockingFailure(com.webobjects.eoaccess.EOGeneralAdaptorException e)
          Returns true if the exception is an optimistic locking exception.
static com.webobjects.eoaccess.EORelationship lastRelationship(com.webobjects.eoaccess.EORelationship relationship)
          Crude hack to get at the end of a relationship path.
static com.webobjects.eocontrol.EOFetchSpecification localizeFetchSpecification(com.webobjects.eocontrol.EOEditingContext ec, com.webobjects.eocontrol.EOFetchSpecification fetchSpecification)
          Returns a new fetch spec by morphing sort oderings containing the keys foo.name returning foo.name_de where appropriate.
static void logExpression(com.webobjects.eoaccess.EOAdaptorChannel channel, com.webobjects.eoaccess.EOSQLExpression expression, long startTime)
           
static void makeEditableSharedEntityNamed(java.lang.String entityName)
          Utility method to make a shared entity editable.
static com.webobjects.eoaccess.EOModelGroup modelGroup(com.webobjects.eocontrol.EOEditingContext ec)
          Similar to the helper in EOUtilities, but allows for null editingContext.
static com.webobjects.foundation.NSDictionary primaryKeyDictionaryForEntity(com.webobjects.eocontrol.EOEditingContext ec, java.lang.String entityName)
          Utility method to generate a new primary key dictionary using the adaptor for a given entity.
static com.webobjects.foundation.NSArray primaryKeysForNewRows(com.webobjects.eocontrol.EOEditingContext ec, java.lang.String entityName, int count)
          Creates count new primary keys for the entity.
static com.webobjects.foundation.NSArray primaryKeysForObjects(com.webobjects.foundation.NSArray eos)
          Creates an array containing all of the primary keys of the given objects.
static com.webobjects.eocontrol.EOQualifier qualifierFromAttributes(com.webobjects.foundation.NSArray attributes, com.webobjects.foundation.NSDictionary values)
          Creates an AND qualifier of EOKeyValueQualifiers for every keypath in the given array of attributes.
static com.webobjects.foundation.NSArray rawRowsForSQLExpression(com.webobjects.eocontrol.EOEditingContext ec, com.webobjects.eoaccess.EOModel model, com.webobjects.eoaccess.EOSQLExpression expression, com.webobjects.foundation.NSArray<com.webobjects.eoaccess.EOAttribute> attributes)
          Returns the raw rows for the given EOSQLExpression.
static com.webobjects.foundation.NSArray<com.webobjects.foundation.NSDictionary> rawRowsForSQLExpression(com.webobjects.eocontrol.EOEditingContext ec, java.lang.String modelName, com.webobjects.eoaccess.EOSQLExpression expression)
          Returns the raw rows for the given EOSQLExpression.
static void reapplyChanges(com.webobjects.eocontrol.EOEnterpriseObject eo, com.webobjects.eoaccess.EOGeneralAdaptorException e)
          Method used to apply a set of changes to a re-fetched eo.
static com.webobjects.eocontrol.EOEnterpriseObject refetchFailedObject(com.webobjects.eocontrol.EOEditingContext ec, com.webobjects.eoaccess.EOGeneralAdaptorException e)
           
static com.webobjects.foundation.NSArray relationshipsForAttribute(com.webobjects.eoaccess.EOEntity entity, com.webobjects.eoaccess.EOAttribute attrib)
          Filters a list of relationships for only the ones that have a given EOAttribute as a source attribute.
static com.webobjects.eoaccess.EOEntity rootEntityForEntity(com.webobjects.eoaccess.EOEntity entity)
           
static com.webobjects.eoaccess.EOEntity rootEntityForEntityNamed(java.lang.String entityName)
           
static int rowCountForFetchSpecification(com.webobjects.eocontrol.EOEditingContext ec, com.webobjects.eocontrol.EOFetchSpecification spec)
          Returns the number of rows the supplied EOFetchSpecification would return.
static void setIsAttributeUsedForLocking(com.webobjects.eoaccess.EOAttribute attr, boolean isUsedForLocking)
          Add or remove an attribute from the entities list of attributes used for locking
static void setIsClassProperty(com.webobjects.eoaccess.EOProperty property, boolean isClassProperty)
          Add or remove a class property from its entity.
static com.webobjects.foundation.NSArray snapshotsForObjectsFromRelationshipNamed(com.webobjects.foundation.NSArray eos, java.lang.String relKey)
          Given an array of EOs, returns snapshot dictionaries for the given related objects.
static com.webobjects.eoaccess.EOAttribute sourceAttributeForRelationship(com.webobjects.eoaccess.EOEntity entity, java.lang.String relationshipName)
          Returns the source attribute for the relationship named relationshipName on entity.
static com.webobjects.eoaccess.EOAttribute sourceAttributeForRelationship(com.webobjects.eoaccess.EORelationship relationship)
          Returns the source attribute for the relationship.
static java.lang.String sourceColumnForRelationship(com.webobjects.eoaccess.EOEntity entity, java.lang.String relationshipName)
          Returns the external column name for the source attribute for the relationship named relationshipName on entity.
static java.lang.String sourceColumnForRelationship(com.webobjects.eoaccess.EORelationship relationship)
          Returns the external column name for the source attribute for the relationship named relationshipName on entity.
static com.webobjects.eoaccess.EOSQLExpression sqlExpressionForFetchSpecification(com.webobjects.eocontrol.EOEditingContext ec, com.webobjects.eocontrol.EOFetchSpecification spec, long start, long end)
          Creates the SQL which is used by the provided EOFetchSpecification, limited by the given range.
static java.lang.String sqlForFetchSpecification(com.webobjects.eocontrol.EOEditingContext ec, com.webobjects.eocontrol.EOFetchSpecification spec)
          Creates the SQL which is used by the provides EOFetchSpecification.
static java.lang.String sqlWhereClauseStringForKey(com.webobjects.eoaccess.EOSQLExpression e, java.lang.String key, com.webobjects.foundation.NSArray valueArray)
          Deprecated.  
static int updateRowsDescribedByQualifier(com.webobjects.eocontrol.EOEditingContext ec, java.lang.String entityName, com.webobjects.eocontrol.EOQualifier qualifier, com.webobjects.foundation.NSDictionary newValues)
          Updates rows described by the qualifier.
static com.webobjects.foundation.NSSet verifyAllSnapshots()
          In a multi-OSC or multi-instance scenario, when there are bugs, it is possible for the snapshots to become out of sync with the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

public static final org.apache.log4j.Logger log
logging support

Constructor Detail

ERXEOAccessUtilities

public ERXEOAccessUtilities()
Method Detail

entityMatchingString

public static com.webobjects.eoaccess.EOEntity entityMatchingString(com.webobjects.eocontrol.EOEditingContext ec,
                                                                    java.lang.String string)
Finds an entity that is contained in a string. This is used a lot in DirectToWeb. Example: "ListAllStudios"=>Studio

Parameters:
ec - editing context
string - string to look into
Returns:
found entity or null

entityUsingTable

public static com.webobjects.eoaccess.EOEntity entityUsingTable(com.webobjects.eocontrol.EOEditingContext ec,
                                                                java.lang.String tableName)
Finds an entity that is associated with the table name. When inheritance is used, will return the least derived entity using that table. This can be used to deal with database exceptions where you only have the table name to go on. As multiple entities can map to a single table, the results of this method are inexact.

Parameters:
ec - editing context
tableName - table (external) name to find an entity for
Returns:
found entity or null

entityWithNamedIsShared

public static boolean entityWithNamedIsShared(com.webobjects.eocontrol.EOEditingContext ec,
                                              java.lang.String entityName)
Method used to determine if a given entity is a shared entity.

Parameters:
ec - editing context
entityName - name of the entity
Returns:
if the entity is a shared entity
Throws:
java.lang.IllegalStateException - if the entityName provided is null

getNextValFromSequenceNamed

public static java.lang.Number getNextValFromSequenceNamed(com.webobjects.eocontrol.EOEditingContext ec,
                                                           java.lang.String modelName,
                                                           java.lang.String sequenceName)
Deprecated. 

Convenience method to get the next unique ID from a sequence.

Parameters:
ec - editing context
modelName - name of the model which connects to the database that has the sequence in it
sequenceName - name of the sequence
Returns:
next value in the sequence

evaluateSQLWithEntityNamed

public static void evaluateSQLWithEntityNamed(com.webobjects.eocontrol.EOEditingContext ec,
                                              java.lang.String entityName,
                                              java.lang.String exp)
Utility method used to execute arbitrary SQL. This has the advantage over the EOUtilities rawRowsForSQL in that it can be used with other statements besides just SELECT without throwing exceptions.

Parameters:
ec - editing context that determines which model group and database context to use.
entityName - name of an entity in the model connected to the database you wish to execute SQL against
exp - SQL expression

evaluateSQLWithEntity

public static void evaluateSQLWithEntity(com.webobjects.eocontrol.EOEditingContext ec,
                                         com.webobjects.eoaccess.EOEntity entity,
                                         java.lang.String exp)
Utility method used to execute arbitrary SQL. This has the advantage over the EOUtilities rawRowsForSQL in that it can be used with other statements besides just SELECT without throwing exceptions.

Parameters:
ec - editing context that determines which model group and database context to use.
entity - an entity in the model connected to the database you wish to execute SQL against
exp - SQL expression

sqlForFetchSpecification

public static java.lang.String sqlForFetchSpecification(com.webobjects.eocontrol.EOEditingContext ec,
                                                        com.webobjects.eocontrol.EOFetchSpecification spec)
Creates the SQL which is used by the provides EOFetchSpecification.

Parameters:
ec - the EOEditingContext
spec - the EOFetchSpecification in question
Returns:
the SQL which the EOFetchSpecification would use

rawRowsForSQLExpression

public static com.webobjects.foundation.NSArray<com.webobjects.foundation.NSDictionary> rawRowsForSQLExpression(com.webobjects.eocontrol.EOEditingContext ec,
                                                                                                                java.lang.String modelName,
                                                                                                                com.webobjects.eoaccess.EOSQLExpression expression)
Returns the raw rows for the given EOSQLExpression. When possible, you should use the variant of this method that requires you to pass in the array of EOAttributes you are fetching. If you do not pass in attributes, this will use channel.describeResults(), which can produce attributes that may not be able to be faulted back into EO's because of case mismatches.

Parameters:
ec - the EOEditingContext
modelName - the name of the model in question
expression - the EOSQLExpression in question
Returns:
array of dictionaries

rawRowsForSQLExpression

public static com.webobjects.foundation.NSArray rawRowsForSQLExpression(com.webobjects.eocontrol.EOEditingContext ec,
                                                                        com.webobjects.eoaccess.EOModel model,
                                                                        com.webobjects.eoaccess.EOSQLExpression expression,
                                                                        com.webobjects.foundation.NSArray<com.webobjects.eoaccess.EOAttribute> attributes)
Returns the raw rows for the given EOSQLExpression.

Parameters:
ec - the EOEditingContext
model - the model in question
expression - the EOSQLExpression to fetch with
attributes - the attributes to fetch
Returns:
array of dictionaries

sqlExpressionForFetchSpecification

public static com.webobjects.eoaccess.EOSQLExpression sqlExpressionForFetchSpecification(com.webobjects.eocontrol.EOEditingContext ec,
                                                                                         com.webobjects.eocontrol.EOFetchSpecification spec,
                                                                                         long start,
                                                                                         long end)
Creates the SQL which is used by the provided EOFetchSpecification, limited by the given range.

Parameters:
ec - the EOEditingContext
spec - the EOFetchSpecification in question
start - start of rows to fetch
end - end of rows to fetch (-1 if not used)
Returns:
the EOSQLExpression which the EOFetchSpecification would use

rowCountForFetchSpecification

public static int rowCountForFetchSpecification(com.webobjects.eocontrol.EOEditingContext ec,
                                                com.webobjects.eocontrol.EOFetchSpecification spec)
Returns the number of rows the supplied EOFetchSpecification would return.

Parameters:
ec - the EOEditingContext
spec - the EOFetchSpecification in question
Returns:
the number of rows

modelGroup

public static com.webobjects.eoaccess.EOModelGroup modelGroup(com.webobjects.eocontrol.EOEditingContext ec)
Similar to the helper in EOUtilities, but allows for null editingContext. If ec is null, it will try to get at the session via thread storage and use its defaultEditingContext. This is here now so we can remove the delegate in ERXApplication.

Parameters:
ec - editing context used to locate the model group (can be null)

entityNamed

public static com.webobjects.eoaccess.EOEntity entityNamed(com.webobjects.eocontrol.EOEditingContext ec,
                                                           java.lang.String entityName)
Similar to the helper in EOUtilities, but allows for null editingContext.

Parameters:
ec - editing context used to locate the model group (can be null)
entityName - entity name

createAggregateAttribute

public static com.webobjects.eoaccess.EOAttribute createAggregateAttribute(com.webobjects.eocontrol.EOEditingContext ec,
                                                                           java.lang.String function,
                                                                           java.lang.String attributeName,
                                                                           java.lang.String entityName)
Creates an aggregate integer attribute for a given function name. These can then be used to query on when using raw rows.

Parameters:
ec - editing context used to locate the model group
function - name of the function MAX, MIN, etc
attributeName - name of the attribute
entityName - name of the entity
Returns:
aggregate function attribute

createAggregateAttribute

public static com.webobjects.eoaccess.EOAttribute createAggregateAttribute(com.webobjects.eocontrol.EOEditingContext ec,
                                                                           java.lang.String function,
                                                                           java.lang.String attributeName,
                                                                           java.lang.String entityName,
                                                                           java.lang.Class valueClass,
                                                                           java.lang.String valueType)
Creates an aggregate attribute for a given function name. These can then be used to query on when using raw rows.

Parameters:
ec - editing context used to locate the model group
function - name of the function MAX, MIN, etc
attributeName - name of the attribute
entityName - name of the entity
valueClass - the java class of this attribute's values
valueType - the EOAttribute value type
Returns:
aggregate function attribute

createAggregateAttribute

public static com.webobjects.eoaccess.EOAttribute createAggregateAttribute(com.webobjects.eocontrol.EOEditingContext ec,
                                                                           java.lang.String function,
                                                                           java.lang.String attributeName,
                                                                           java.lang.String entityName,
                                                                           java.lang.Class valueClass,
                                                                           java.lang.String valueType,
                                                                           java.lang.String aggregateName)
Creates an aggregate attribute for a given function name. These can then be used to query on when using raw rows.

Parameters:
ec - editing context used to locate the model group
function - name of the function MAX, MIN, etc
attributeName - name of the attribute
entityName - name of the entity
aggregateName - the name to assign to the aggregate column in the query
valueClass - the java class of this attribute's values
valueType - the EOAttribute value type
Returns:
aggregate function attribute

createAggregateAttribute

public static com.webobjects.eoaccess.EOAttribute createAggregateAttribute(com.webobjects.eocontrol.EOEditingContext ec,
                                                                           java.lang.String function,
                                                                           java.lang.String attributeName,
                                                                           java.lang.String entityName,
                                                                           java.lang.Class valueClass,
                                                                           java.lang.String valueType,
                                                                           java.lang.String aggregateName,
                                                                           java.lang.String entityTableAlias)
Creates an aggregate attribute for a given function name. These can then be used to query on when using raw rows.

Parameters:
ec - editing context used to locate the model group
function - name of the function MAX, MIN, etc
attributeName - name of the attribute
entityName - name of the entity
aggregateName - the name to assign to the aggregate column in the query
valueClass - the java class of this attribute's values
valueType - the EOAttribute value type
entityTableAlias - the "t0"-style name of the attribute in this query (or null for "t0")
Returns:
aggregate function attribute

createSchemaSQLForEntitiesInModelWithNameAndOptionsForOracle9

public static java.lang.String createSchemaSQLForEntitiesInModelWithNameAndOptionsForOracle9(com.webobjects.foundation.NSArray entities,
                                                                                             java.lang.String modelName,
                                                                                             com.webobjects.foundation.NSDictionary optionsCreate)
oracle 9 has a maximum length of 30 characters for table names, column names and constraint names Foreign key constraint names are defined like this from the plugin:

TABLENAME_FOEREIGNKEYNAME_FK

The whole statement looks like this:

ALTER TABLE [TABLENAME] ADD CONSTRAINT [CONSTRAINTNAME] FOREIGN KEY ([FK]) REFERENCES [DESTINATION_TABLE] ([PK]) DEFERRABLE INITIALLY DEFERRED THIS means that the tablename and the columnname together cannot be longer than 26 characters.

This method checks each foreign key constraint name and if it is longer than 30 characters its replaced with a unique name.

See Also:
createSchemaSQLForEntitiesInModelWithNameAndOptions

createSchemaSQLForEntitiesInModelWithNameAndOptions

public static java.lang.String createSchemaSQLForEntitiesInModelWithNameAndOptions(com.webobjects.foundation.NSArray entities,
                                                                                   java.lang.String modelName,
                                                                                   com.webobjects.foundation.NSDictionary optionsCreate)
Deprecated. 

creates SQL to create tables for the specified Entities. This can be used with EOUtilities rawRowsForSQL method to create the tables.

Parameters:
entities - a NSArray containing the entities for which create table statements should be generated or null if all entitites in the model should be used.
modelName - the name of the EOModel
optionsCreate - a NSDictionary containing the different options. Possible keys are
  • EOSchemaGeneration.DropTablesKey
  • EOSchemaGeneration.DropPrimaryKeySupportKey
  • EOSchemaGeneration.CreateTablesKey
  • EOSchemaGeneration.CreatePrimaryKeySupportKey
  • EOSchemaGeneration.PrimaryKeyConstraintsKey
  • EOSchemaGeneration.ForeignKeyConstraintsKey
  • EOSchemaGeneration.CreateDatabaseKey
  • EOSchemaGeneration.DropDatabaseKey


  • Possible values are YES and NO
    Returns:
    a String containing SQL statements to create tables

    createSchemaSQLForEntitiesWithOptions

    public static java.lang.String createSchemaSQLForEntitiesWithOptions(com.webobjects.foundation.NSArray entities,
                                                                         com.webobjects.eoaccess.EODatabaseContext databaseContext,
                                                                         com.webobjects.foundation.NSDictionary optionsCreate)
    Deprecated. 

    Creates the schema sql for a set of entities.

    Parameters:
    entities - the entities to create sql for
    databaseContext - the database context to use
    optionsCreate - the options (@see createSchemaSQLForEntitiesInModelWithNameAndOptions)
    Returns:
    a sql script

    createSchemaSQLForEntitiesInModelWithName

    public static java.lang.String createSchemaSQLForEntitiesInModelWithName(com.webobjects.foundation.NSArray entities,
                                                                             java.lang.String modelName)
    Deprecated. 

    creates SQL to create tables for the specified Entities. This can be used with EOUtilities rawRowsForSQL method to create the tables.

    Parameters:
    entities - a NSArray containing the entities for which create table statements should be generated or null if all entitites in the model should be used.
    modelName - the name of the EOModel

    This method uses the following defaults options:
    • EOSchemaGeneration.DropTablesKey=YES
    • EOSchemaGeneration.DropPrimaryKeySupportKey=YES
    • EOSchemaGeneration.CreateTablesKey=YES
    • EOSchemaGeneration.CreatePrimaryKeySupportKey=YES
    • EOSchemaGeneration.PrimaryKeyConstraintsKey=YES
    • EOSchemaGeneration.ForeignKeyConstraintsKey=YES
    • EOSchemaGeneration.CreateDatabaseKey=NO
    • EOSchemaGeneration.DropDatabaseKey=NO


    Possible values are YES and NO
    Returns:
    a String containing SQL statements to create tables

    createSchemaSQLForEntitiesInDatabaseContext

    public static java.lang.String createSchemaSQLForEntitiesInDatabaseContext(com.webobjects.foundation.NSArray entities,
                                                                               com.webobjects.eoaccess.EODatabaseContext databaseContext,
                                                                               boolean create,
                                                                               boolean drop)
    Deprecated. 

    creates SQL to create tables for the specified Entities. This can be used with EOUtilities rawRowsForSQL method to create the tables.

    Parameters:
    entities - a NSArray containing the entities for which create table statements should be generated or null if all entitites in the model should be used.
    databaseContext - the databaseContext
    create - if true, tables and keys are created
    drop - if true, tables and keys are dropped
    Returns:
    a String containing SQL statements to create tables

    createIndexSQLForEntitiesForOracle

    public static java.lang.String createIndexSQLForEntitiesForOracle(com.webobjects.foundation.NSArray entities)
    Deprecated. 


    createIndexSQLForEntities

    public static java.lang.String createIndexSQLForEntities(com.webobjects.foundation.NSArray entities)
    Deprecated. 


    createIndexSQLForEntities

    public static java.lang.String createIndexSQLForEntities(com.webobjects.foundation.NSArray entities,
                                                             com.webobjects.foundation.NSArray externalTypesToIgnore)
    Deprecated. 


    entityUsesSeparateTable

    public static boolean entityUsesSeparateTable(com.webobjects.eoaccess.EOEntity entity)

    attributeWithColumnNameFromEntity

    public static com.webobjects.eoaccess.EOAttribute attributeWithColumnNameFromEntity(java.lang.String columnName,
                                                                                        com.webobjects.eoaccess.EOEntity entity)

    isOptimisticLockingFailure

    public static boolean isOptimisticLockingFailure(com.webobjects.eoaccess.EOGeneralAdaptorException e)
    Returns true if the exception is an optimistic locking exception.

    Parameters:
    e - the exception as recieved from saveChanges()
    Returns:
    true if the error could be handled.

    snapshotsForObjectsFromRelationshipNamed

    public static com.webobjects.foundation.NSArray snapshotsForObjectsFromRelationshipNamed(com.webobjects.foundation.NSArray eos,
                                                                                             java.lang.String relKey)
    Given an array of EOs, returns snapshot dictionaries for the given related objects.


    primaryKeyDictionaryForEntity

    public static com.webobjects.foundation.NSDictionary primaryKeyDictionaryForEntity(com.webobjects.eocontrol.EOEditingContext ec,
                                                                                       java.lang.String entityName)
    Utility method to generate a new primary key dictionary using the adaptor for a given entity. This is can be handy if you need to have a primary key for an object before it is saved to the database. This method uses the same method that EOF uses by default for generating primary keys. See ERXGeneratesPrimaryKeyInterfacefor more information about using a newly created dictionary as the primary key for an enterprise object.

    Parameters:
    ec - editing context
    entityName - name of the entity to generate the primary key dictionary for.
    Returns:
    a dictionary containing a new primary key for the given entity.

    primaryKeysForObjects

    public static com.webobjects.foundation.NSArray primaryKeysForObjects(com.webobjects.foundation.NSArray eos)
    Creates an array containing all of the primary keys of the given objects.

    Parameters:
    eos - array of enterprise objects

    lastRelationship

    public static com.webobjects.eoaccess.EORelationship lastRelationship(com.webobjects.eoaccess.EORelationship relationship)
    Crude hack to get at the end of a relationship path.

    Parameters:
    relationship -

    attributePathForKeyPath

    public static com.webobjects.foundation.NSArray attributePathForKeyPath(com.webobjects.eoaccess.EOEntity entity,
                                                                            java.lang.String keyPath)
    Creates an array of relationships and attributes from the given keypath to give to the EOSQLExpression method sqlStringForAttributePath. If the last element is a relationship, then the relationship's source attribute will get chosen. As such, this can only work for single-value relationships in the last element.

    Parameters:
    entity -
    keyPath -

    sqlWhereClauseStringForKey

    public static java.lang.String sqlWhereClauseStringForKey(com.webobjects.eoaccess.EOSQLExpression e,
                                                              java.lang.String key,
                                                              com.webobjects.foundation.NSArray valueArray)
    Deprecated. 

    Creates a where clause string " someKey IN ( someValue1,...)". Can migrate keyPaths.


    databaseContextForObject

    public static com.webobjects.eoaccess.EODatabaseContext databaseContextForObject(com.webobjects.eocontrol.EOEnterpriseObject eo)
    Returns the database context for an EO.

    Parameters:
    eo - the EO to get a database context for
    Returns:
    the eo's database context

    databaseContextForEntityNamed

    public static com.webobjects.eoaccess.EODatabaseContext databaseContextForEntityNamed(com.webobjects.eocontrol.EOObjectStoreCoordinator osc,
                                                                                          java.lang.String entityName)
    Returns the database context for the given entity in the given EOObjectStoreCoordinator

    Parameters:
    entityName -
    osc -

    closeDatabaseConnections

    public static boolean closeDatabaseConnections(com.webobjects.eocontrol.EOObjectStoreCoordinator osc)
    Closes the (JDBC) Connection from all database channels for the specified EOObjectStoreCoordinator

    Parameters:
    osc - the EOObjectStoreCoordinator from which the (JDBC)Connections should be closed

    destinationEntityForKeyPath

    public static com.webobjects.eoaccess.EOEntity destinationEntityForKeyPath(com.webobjects.eoaccess.EOEntity entity,
                                                                               java.lang.String keyPath)

    entityForEo

    public static com.webobjects.eoaccess.EOEntity entityForEo(com.webobjects.eocontrol.EOEnterpriseObject eo)
    Returns the EOEntity for the provided EOEnterpriseObject if one exists

    Parameters:
    eo - the EOEnterpriseObject
    Returns:
    the EOEntity from the EOEnterpriseObject

    classPropertiesNotInParent

    public static com.webobjects.foundation.NSArray classPropertiesNotInParent(com.webobjects.eoaccess.EOEntity entity,
                                                                               boolean includeAttributes,
                                                                               boolean includeToOneRelationships,
                                                                               boolean includeToManyRelationships)

    externalNamesForEntity

    public static com.webobjects.foundation.NSArray externalNamesForEntity(com.webobjects.eoaccess.EOEntity entity,
                                                                           boolean includeParentEntities)

    externalNamesForEntityNamed

    public static com.webobjects.foundation.NSArray externalNamesForEntityNamed(java.lang.String entityName,
                                                                                boolean includeParentEntities)

    rootEntityForEntity

    public static com.webobjects.eoaccess.EOEntity rootEntityForEntity(com.webobjects.eoaccess.EOEntity entity)

    rootEntityForEntityNamed

    public static com.webobjects.eoaccess.EOEntity rootEntityForEntityNamed(java.lang.String entityName)

    logExpression

    public static void logExpression(com.webobjects.eoaccess.EOAdaptorChannel channel,
                                     com.webobjects.eoaccess.EOSQLExpression expression,
                                     long startTime)

    createLogString

    public static java.lang.String createLogString(com.webobjects.eoaccess.EOAdaptorChannel channel,
                                                   com.webobjects.eoaccess.EOSQLExpression expression,
                                                   long millisecondsNeeded)

    qualifierFromAttributes

    public static com.webobjects.eocontrol.EOQualifier qualifierFromAttributes(com.webobjects.foundation.NSArray attributes,
                                                                               com.webobjects.foundation.NSDictionary values)
    Creates an AND qualifier of EOKeyValueQualifiers for every keypath in the given array of attributes.

    Author:
    ak

    relationshipsForAttribute

    public static com.webobjects.foundation.NSArray relationshipsForAttribute(com.webobjects.eoaccess.EOEntity entity,
                                                                              com.webobjects.eoaccess.EOAttribute attrib)
    Filters a list of relationships for only the ones that have a given EOAttribute as a source attribute.

    Parameters:
    attrib - EOAttribute to filter source attributes of relationships.
    Returns:
    filtered array of EORelationship objects that have the given attribute as the source attribute.

    sourceAttributeForRelationship

    public static com.webobjects.eoaccess.EOAttribute sourceAttributeForRelationship(com.webobjects.eoaccess.EOEntity entity,
                                                                                     java.lang.String relationshipName)
    Returns the source attribute for the relationship named relationshipName on entity. Assumes there is only one join.

    Parameters:
    entity - EOEntity to find relationship on
    relationshipName - name of relationship on entity
    Returns:
    source attribute for the relationship

    sourceAttributeForRelationship

    public static com.webobjects.eoaccess.EOAttribute sourceAttributeForRelationship(com.webobjects.eoaccess.EORelationship relationship)
    Returns the source attribute for the relationship. Assumes there is only one join.

    Parameters:
    relationship - relationship on entity to return source attribute for
    Returns:
    source attribute for the relationship

    sourceColumnForRelationship

    public static java.lang.String sourceColumnForRelationship(com.webobjects.eoaccess.EOEntity entity,
                                                               java.lang.String relationshipName)
    Returns the external column name for the source attribute for the relationship named relationshipName on entity. Assumes there is only one join. This is intend to support the *RowsDescribedByQualifier methods when used with relationships.

    Parameters:
    entity - EOEntity to find relationship on
    relationshipName - name of relationship on entity
    Returns:
    the external column name for the source attribute for the relationship

    sourceColumnForRelationship

    public static java.lang.String sourceColumnForRelationship(com.webobjects.eoaccess.EORelationship relationship)
    Returns the external column name for the source attribute for the relationship named relationshipName on entity. Assumes there is only one join. This is intend to support the *RowsDescribedByQualifier methods when used with relationships.

    Parameters:
    relationship - relationship on entity to return the external column name for the source attribute for
    Returns:
    the external column name for the source attribute for the relationship

    refetchFailedObject

    public static com.webobjects.eocontrol.EOEnterpriseObject refetchFailedObject(com.webobjects.eocontrol.EOEditingContext ec,
                                                                                  com.webobjects.eoaccess.EOGeneralAdaptorException e)

    reapplyChanges

    public static void reapplyChanges(com.webobjects.eocontrol.EOEnterpriseObject eo,
                                      com.webobjects.eoaccess.EOGeneralAdaptorException e)
    Method used to apply a set of changes to a re-fetched eo. This method is used to re-apply changes to a given eo after it has been refetched.

    Parameters:
    eo - enterprise object to have the changes re-applied to.

    deleteRowsDescribedByQualifier

    public static int deleteRowsDescribedByQualifier(com.webobjects.eocontrol.EOEditingContext ec,
                                                     java.lang.String entityName,
                                                     com.webobjects.eocontrol.EOQualifier qualifier)
    Deletes rows described by the qualifier. Note that the values and the qualifier need to be on an attribute and not on a relationship level. I.e. you need to give relationshipForeignKey = pk of object instead of relatedObject = object

    Parameters:
    ec -
    entityName -
    qualifier -

    updateRowsDescribedByQualifier

    public static int updateRowsDescribedByQualifier(com.webobjects.eocontrol.EOEditingContext ec,
                                                     java.lang.String entityName,
                                                     com.webobjects.eocontrol.EOQualifier qualifier,
                                                     com.webobjects.foundation.NSDictionary newValues)
    Updates rows described by the qualifier. Note that the values and the qualifier need to be on an attribute and not on a relationship level. I.e. you need to give relationshipForeignKey = pk of object instead of relatedObject = object. The newValues dictionaries also holds foreign keys, not objects.

    Parameters:
    ec -
    entityName -
    qualifier -
    newValues -

    insertRow

    public static int insertRow(com.webobjects.eocontrol.EOEditingContext ec,
                                java.lang.String entityName,
                                com.webobjects.foundation.NSDictionary newValues)
    Insert row described dictionary.

    Parameters:
    ec -
    entityName -
    newValues -

    insertRows

    public static int insertRows(com.webobjects.eocontrol.EOEditingContext ec,
                                 java.lang.String entityName,
                                 java.util.Collection<? extends com.webobjects.foundation.NSDictionary<java.lang.String,?>> newValues)
    Insert rows described the array of dictionaries.

    Parameters:
    ec -
    entityName -
    newValues -

    primaryKeysForNewRows

    public static com.webobjects.foundation.NSArray primaryKeysForNewRows(com.webobjects.eocontrol.EOEditingContext ec,
                                                                          java.lang.String entityName,
                                                                          int count)
    Creates count new primary keys for the entity.

    Parameters:
    ec -
    entityName -
    count -

    guessPluginName

    public static java.lang.String guessPluginName(com.webobjects.eoaccess.EOModel model)
    Tries to get the plugin name for a JDBC based model.

    Parameters:
    model -

    guessPluginNameForConnectionDictionary

    public static java.lang.String guessPluginNameForConnectionDictionary(com.webobjects.foundation.NSDictionary connectionDictionary)
    Tries to get the plugin name for a connection dictionary.

    Parameters:
    connectionDictionary - the connectionDictionary to guess a plugin name for
    Returns:
    the plugin name

    localizeFetchSpecification

    public static com.webobjects.eocontrol.EOFetchSpecification localizeFetchSpecification(com.webobjects.eocontrol.EOEditingContext ec,
                                                                                           com.webobjects.eocontrol.EOFetchSpecification fetchSpecification)
    Returns a new fetch spec by morphing sort oderings containing the keys foo.name returning foo.name_de where appropriate.

    Parameters:
    ec -
    fetchSpecification -

    batchFetchRelationship

    public static void batchFetchRelationship(com.webobjects.eoaccess.EODatabaseContext databaseContext,
                                              java.lang.String entityName,
                                              java.lang.String relationshipName,
                                              com.webobjects.foundation.NSArray objects,
                                              com.webobjects.eocontrol.EOEditingContext editingContext,
                                              boolean skipFaultedRelationships)
    Batch fetch a relationship, optionally skipping any relationship that has already faulted in its to-many relationship.

    Parameters:
    databaseContext - the database context to fetch in
    entityName - the name of the entity to fetch on
    relationshipName - the name of the relationship in that entity to fetch
    objects - the objects to fetch the relationship on
    editingContext - the editingContext to fetch in
    skipFaultedRelationships - if true, skip any object whose relationship has already been faulted

    batchFetchRelationship

    public static void batchFetchRelationship(com.webobjects.eoaccess.EODatabaseContext databaseContext,
                                              com.webobjects.eoaccess.EORelationship relationship,
                                              com.webobjects.foundation.NSArray objects,
                                              com.webobjects.eocontrol.EOEditingContext editingContext,
                                              boolean skipFaultedRelationships)
    Batch fetch a relationship, optionally skipping any relationship that has already faulted in its to-many relationship.

    Parameters:
    databaseContext - the database context to fetch in
    relationship - the relationship to fetch
    objects - the objects to fetch the relationship on
    editingContext - the editingContext to fetch in
    skipFaultedRelationships - if true, skip any object whose relationship has already been faulted

    verifyAllSnapshots

    public static com.webobjects.foundation.NSSet verifyAllSnapshots()
    In a multi-OSC or multi-instance scenario, when there are bugs, it is possible for the snapshots to become out of sync with the database. It is useful to have some way to determine when exactly this condition occurs for writing test cases.

    Returns:
    a set of strings that describe the mismatches that occurred

    makeEditableSharedEntityNamed

    public static void makeEditableSharedEntityNamed(java.lang.String entityName)
    Utility method to make a shared entity editable. This can be useful if you want to have an adminstration application that can edit shared enterprise objects and need a way at start up to disable the sharing constraints.

    Parameters:
    entityName - name of the shared entity to make shareable.

    createRelationship

    public static com.webobjects.eoaccess.EORelationship createRelationship(java.lang.String relationshipName,
                                                                            java.lang.String sourceEntityName,
                                                                            java.lang.String sourceAttributeName,
                                                                            java.lang.String destinationEntityName,
                                                                            java.lang.String destinationAttributeName,
                                                                            boolean toMany,
                                                                            int deleteRule,
                                                                            boolean isMandatory,
                                                                            boolean isClassProperty,
                                                                            boolean shouldPropagatePrimaryKey)
    Programatically adds a toOne or toMany relationship to an entity at runtime.

    Parameters:
    relationshipName - name of the relationship to be created on the source entity
    sourceEntityName - name of the source entity
    sourceAttributeName - name of the attribute in the source entity to be used by the join
    destinationEntityName - name of the destination entity
    destinationAttributeName - name of the attribute in the destination entity to be used by the join
    toMany - if true, the relationship will be toMany, otherwise it will be toOne
    deleteRule - EOClassDescription.DeleteRuleCascade || EOClassDescription.DeleteRuleDeny || EOClassDescription.DeleteRuleNoAction || EOClassDescription.DeleteRuleNullify
    isMandatory - mandatory or not
    isClassProperty - class property or not
    shouldPropagatePrimaryKey - propagate prmary key or not
    Returns:
    the newly created relationship
    Author:
    th

    createFlattenedRelationship

    public static com.webobjects.eoaccess.EORelationship createFlattenedRelationship(java.lang.String relationshipName,
                                                                                     java.lang.String sourceEntityName,
                                                                                     java.lang.String definition,
                                                                                     int deleteRule,
                                                                                     boolean isMandatory,
                                                                                     boolean isClassProperty)
    Programatically adds a flattened relationship to an entity at runtime.

    Parameters:
    relationshipName - name of the relationship to be created on the source entity
    sourceEntityName - name of the source entity
    definition - data path of the relationship (e.g. department.facility)
    deleteRule - EOClassDescription.DeleteRuleCascade || EOClassDescription.DeleteRuleDeny || EOClassDescription.DeleteRuleNoAction || EOClassDescription.DeleteRuleNullify
    isMandatory - mandatory or not
    isClassProperty - class property or not
    Returns:
    the newly created relationship
    Author:
    th

    executeDatabaseContextOperation

    public static <T> T executeDatabaseContextOperation(com.webobjects.eoaccess.EODatabaseContext databaseContext,
                                                        int maxAttempts,
                                                        ERXEOAccessUtilities.DatabaseContextOperation<T> operation)
    Executes the given database context operation within a database context lock, retrying up to maxRetryCount times if the database connection dropped.

    Type Parameters:
    T - the type of the results of this operation
    Parameters:
    databaseContext - the (possibly unlocked) database context to operate on
    maxAttempts - the maximum number of times to reattempt the operation before failing
    operation - the database context operation to perform

    executeAdaptorChannelOperation

    public static <T> T executeAdaptorChannelOperation(com.webobjects.eoaccess.EODatabaseContext databaseContext,
                                                       int maxAttempts,
                                                       ERXEOAccessUtilities.AdaptorChannelOperation<T> operation)
    Executes the given adaptor channel operation within a database context lock and with a requested open channel, retrying up to maxRetryCount times if the database connection dropped.

    Type Parameters:
    T - the type of the results of this operation
    Parameters:
    databaseContext - the (possibly unlocked) database context to operate on
    maxAttempts - the maximum number of times to reattempt the operation before failing
    operation - the adaptor channel operation to perform

    executeAdaptorChannelOperation

    public static <T> T executeAdaptorChannelOperation(java.lang.String modelName,
                                                       int maxAttempts,
                                                       ERXEOAccessUtilities.AdaptorChannelOperation<T> operation)
    Executes the given adaptor channel operation within a database context lock and with a requested open channel, retrying up to maxRetryCount times if the database connection dropped.

    Type Parameters:
    T - the type of the results of this operation
    Parameters:
    modelName - the name of the model to lookup a database context for
    maxAttempts - the maximum number of times to reattempt the operation before failing
    operation - the adaptor channel operation to perform

    setIsClassProperty

    public static void setIsClassProperty(com.webobjects.eoaccess.EOProperty property,
                                          boolean isClassProperty)
    Add or remove a class property from its entity.

    Parameters:
    property - The property to add or remove from the class properties array
    isClassProperty - true adds the property to the list of class properties, false removes it.

    setIsAttributeUsedForLocking

    public static void setIsAttributeUsedForLocking(com.webobjects.eoaccess.EOAttribute attr,
                                                    boolean isUsedForLocking)
    Add or remove an attribute from the entities list of attributes used for locking

    Parameters:
    attr - the attribute to add or remove
    isUsedForLocking - true adds the attribute, false removes it

    entityHierarchyNamesForEntityNamed

    public static com.webobjects.foundation.NSArray<java.lang.String> entityHierarchyNamesForEntityNamed(com.webobjects.eocontrol.EOEditingContext ec,
                                                                                                         java.lang.String rootEntityName)
    Parameters:
    rootEntityName -
    Returns:
    a list of all concrete entity names that inherit from rootEntityName, including rootEntityName itself if it is concrete.

    entityHierarchyForEntity

    public static com.webobjects.foundation.NSArray<com.webobjects.eoaccess.EOEntity> entityHierarchyForEntity(com.webobjects.eocontrol.EOEditingContext ec,
                                                                                                               com.webobjects.eoaccess.EOEntity rootEntity)
    Parameters:
    rootEntity -
    Returns:
    a list of all concrete entities that inherit from rootEntity, including rootEntity itself if it is concrete.

    Last updated: Tue, Feb 21, 2017 • 05:45 PM CET

    Copyright © 2002 – 2007 Project Wonder.