ERXEOAccessUtilities Class Reference

Collaboration diagram for ERXEOAccessUtilities:

Collaboration graph
[legend]

List of all members.

Classes

interface  AdaptorChannelOperation< T >
class  ChannelAction
interface  DatabaseContextOperation< T >

Static Public Member Functions

static NSArray attributePathForKeyPath (EOEntity entity, String keyPath)
static EOAttribute attributeWithColumnNameFromEntity (String columnName, EOEntity entity)
static void batchFetchRelationship (EODatabaseContext databaseContext, EORelationship relationship, NSArray objects, EOEditingContext editingContext, boolean skipFaultedRelationships)
static void batchFetchRelationship (EODatabaseContext databaseContext, String entityName, String relationshipName, NSArray objects, EOEditingContext editingContext, boolean skipFaultedRelationships)
static NSArray classPropertiesNotInParent (EOEntity entity, boolean includeAttributes, boolean includeToOneRelationships, boolean includeToManyRelationships)
static boolean closeDatabaseConnections (EOObjectStoreCoordinator osc)
static EOAttribute createAggregateAttribute (EOEditingContext ec, String function, String attributeName, String entityName, Class valueClass, String valueType, String aggregateName, String entityTableAlias)
static EOAttribute createAggregateAttribute (EOEditingContext ec, String function, String attributeName, String entityName, Class valueClass, String valueType, String aggregateName)
static EOAttribute createAggregateAttribute (EOEditingContext ec, String function, String attributeName, String entityName, Class valueClass, String valueType)
static EOAttribute createAggregateAttribute (EOEditingContext ec, String function, String attributeName, String entityName)
static EORelationship createFlattenedRelationship (String relationshipName, String sourceEntityName, String definition, int deleteRule, boolean isMandatory, boolean isClassProperty)
static String createIndexSQLForEntities (NSArray entities, NSArray externalTypesToIgnore)
static String createIndexSQLForEntities (NSArray entities)
static String createIndexSQLForEntitiesForOracle (NSArray entities)
static String createLogString (EOAdaptorChannel channel, EOSQLExpression expression, long millisecondsNeeded)
static EORelationship createRelationship (String relationshipName, String sourceEntityName, String sourceAttributeName, String destinationEntityName, String destinationAttributeName, boolean toMany, int deleteRule, boolean isMandatory, boolean isClassProperty, boolean shouldPropagatePrimaryKey)
static String createSchemaSQLForEntitiesInDatabaseContext (NSArray entities, EODatabaseContext databaseContext, boolean create, boolean drop)
static String createSchemaSQLForEntitiesInModelWithName (NSArray entities, String modelName)
static String createSchemaSQLForEntitiesInModelWithNameAndOptions (NSArray entities, String modelName, NSDictionary optionsCreate)
static String createSchemaSQLForEntitiesInModelWithNameAndOptionsForOracle9 (NSArray entities, String modelName, NSDictionary optionsCreate)
static String createSchemaSQLForEntitiesWithOptions (NSArray entities, EODatabaseContext databaseContext, NSDictionary optionsCreate)
static EODatabaseContext databaseContextForEntityNamed (EOObjectStoreCoordinator osc, String entityName)
static EODatabaseContext databaseContextForObject (EOEnterpriseObject eo)
static int deleteRowsDescribedByQualifier (EOEditingContext ec, String entityName, final EOQualifier qualifier)
static EOEntity destinationEntityForKeyPath (EOEntity entity, String keyPath)
static EOEntity entityForEo (EOEnterpriseObject eo)
static NSArray< EOEntity > entityHierarchyForEntity (EOEditingContext ec, EOEntity rootEntity)
static NSArray< StringentityHierarchyNamesForEntityNamed (EOEditingContext ec, String rootEntityName)
static EOEntity entityMatchingString (EOEditingContext ec, String string)
static EOEntity entityNamed (EOEditingContext ec, String entityName)
static boolean entityUsesSeparateTable (EOEntity entity)
static EOEntity entityUsingTable (EOEditingContext ec, String tableName)
static boolean entityWithNamedIsShared (EOEditingContext ec, String entityName)
static void evaluateSQLWithEntity (EOEditingContext ec, EOEntity entity, String exp)
static void evaluateSQLWithEntityNamed (EOEditingContext ec, String entityName, String exp)
static< T > T executeAdaptorChannelOperation (final String modelName, final int maxAttempts, final AdaptorChannelOperation< T > operation)
static< T > T executeAdaptorChannelOperation (final EODatabaseContext databaseContext, final int maxAttempts, final AdaptorChannelOperation< T > operation)
static< T > T executeDatabaseContextOperation (final EODatabaseContext databaseContext, final int maxAttempts, final DatabaseContextOperation< T > operation)
static NSArray externalNamesForEntity (EOEntity entity, boolean includeParentEntities)
static NSArray externalNamesForEntityNamed (String entityName, boolean includeParentEntities)
static Number getNextValFromSequenceNamed (EOEditingContext ec, String modelName, String sequenceName)
static String guessPluginName (EOModel model)
static String guessPluginNameForConnectionDictionary (NSDictionary connectionDictionary)
static int insertRow (EOEditingContext ec, String entityName, final NSDictionary newValues)
static int insertRows (EOEditingContext ec, String entityName, final Collection<?extends NSDictionary< String,?>> newValues)
static boolean isOptimisticLockingFailure (EOGeneralAdaptorException e)
static EORelationship lastRelationship (EORelationship relationship)
static EOFetchSpecification localizeFetchSpecification (EOEditingContext ec, EOFetchSpecification fetchSpecification)
static void logExpression (EOAdaptorChannel channel, EOSQLExpression expression, long startTime)
static void makeEditableSharedEntityNamed (String entityName)
static EOModelGroup modelGroup (EOEditingContext ec)
static NSDictionary primaryKeyDictionaryForEntity (EOEditingContext ec, String entityName)
static NSArray primaryKeysForNewRows (EOEditingContext ec, String entityName, final int count)
static NSArray primaryKeysForObjects (NSArray eos)
static EOQualifier qualifierFromAttributes (NSArray attributes, NSDictionary values)
static NSArray rawRowsForSQLExpression (EOEditingContext ec, EOModel model, EOSQLExpression expression, NSArray< EOAttribute > attributes)
static NSArray< NSDictionary > rawRowsForSQLExpression (EOEditingContext ec, String modelName, EOSQLExpression expression)
static void reapplyChanges (EOEnterpriseObject eo, EOGeneralAdaptorException e)
static EOEnterpriseObject refetchFailedObject (EOEditingContext ec, EOGeneralAdaptorException e)
static NSArray relationshipsForAttribute (EOEntity entity, EOAttribute attrib)
static EOEntity rootEntityForEntity (EOEntity entity)
static EOEntity rootEntityForEntityNamed (String entityName)
static int rowCountForFetchSpecification (EOEditingContext ec, EOFetchSpecification spec)
static void setIsAttributeUsedForLocking (EOAttribute attr, boolean isUsedForLocking)
static void setIsClassProperty (EOProperty property, boolean isClassProperty)
static NSArray snapshotsForObjectsFromRelationshipNamed (NSArray eos, String relKey)
static EOAttribute sourceAttributeForRelationship (EORelationship relationship)
static EOAttribute sourceAttributeForRelationship (EOEntity entity, String relationshipName)
static String sourceColumnForRelationship (EORelationship relationship)
static String sourceColumnForRelationship (EOEntity entity, String relationshipName)
static EOSQLExpression sqlExpressionForFetchSpecification (EOEditingContext ec, EOFetchSpecification spec, long start, long end)
static String sqlForFetchSpecification (EOEditingContext ec, EOFetchSpecification spec)
static String sqlWhereClauseStringForKey (EOSQLExpression e, String key, NSArray valueArray)
static int updateRowsDescribedByQualifier (EOEditingContext ec, String entityName, final EOQualifier qualifier, final NSDictionary newValues)
static NSSet verifyAllSnapshots ()

Static Public Attributes

static final Logger log = Logger.getLogger(ERXEOAccessUtilities.class)

Static Private Member Functions

static NSArray _rawRowsForSQLExpression (EODatabaseContext dbc, EOSQLExpression expression, NSArray< EOAttribute > attributes)

Static Private Attributes

static Set _keysWithWarning = Collections.synchronizedSet(new HashSet())
static Logger sqlLoggingLogger = null


Detailed Description

Collection of EOAccess related utilities.

EOAccess provides the data access mechanisms for the Enterprise Objects technology.


Member Function Documentation

static NSArray _rawRowsForSQLExpression ( EODatabaseContext  dbc,
EOSQLExpression  expression,
NSArray< EOAttribute >  attributes 
) [static, private]

static NSArray attributePathForKeyPath ( EOEntity  entity,
String  keyPath 
) [static]

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 

static EOAttribute attributeWithColumnNameFromEntity ( String  columnName,
EOEntity  entity 
) [static]

static void batchFetchRelationship ( EODatabaseContext  databaseContext,
EORelationship  relationship,
NSArray  objects,
EOEditingContext  editingContext,
boolean  skipFaultedRelationships 
) [static]

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

static void batchFetchRelationship ( EODatabaseContext  databaseContext,
String  entityName,
String  relationshipName,
NSArray  objects,
EOEditingContext  editingContext,
boolean  skipFaultedRelationships 
) [static]

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

static NSArray classPropertiesNotInParent ( EOEntity  entity,
boolean  includeAttributes,
boolean  includeToOneRelationships,
boolean  includeToManyRelationships 
) [static]

static boolean closeDatabaseConnections ( EOObjectStoreCoordinator  osc  )  [static]

Closes the (JDBC) Connection from all database channels for the specified EOObjectStoreCoordinator

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

static EOAttribute createAggregateAttribute ( EOEditingContext  ec,
String  function,
String  attributeName,
String  entityName,
Class  valueClass,
String  valueType,
String  aggregateName,
String  entityTableAlias 
) [static]

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

static EOAttribute createAggregateAttribute ( EOEditingContext  ec,
String  function,
String  attributeName,
String  entityName,
Class  valueClass,
String  valueType,
String  aggregateName 
) [static]

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

static EOAttribute createAggregateAttribute ( EOEditingContext  ec,
String  function,
String  attributeName,
String  entityName,
Class  valueClass,
String  valueType 
) [static]

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

static EOAttribute createAggregateAttribute ( EOEditingContext  ec,
String  function,
String  attributeName,
String  entityName 
) [static]

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

static EORelationship createFlattenedRelationship ( String  relationshipName,
String  sourceEntityName,
String  definition,
int  deleteRule,
boolean  isMandatory,
boolean  isClassProperty 
) [static]

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

static String createIndexSQLForEntities ( NSArray  entities,
NSArray  externalTypesToIgnore 
) [static]

static String createIndexSQLForEntities ( NSArray  entities  )  [static]

static String createIndexSQLForEntitiesForOracle ( NSArray  entities  )  [static]

static String createLogString ( EOAdaptorChannel  channel,
EOSQLExpression  expression,
long  millisecondsNeeded 
) [static]

static EORelationship createRelationship ( String  relationshipName,
String  sourceEntityName,
String  sourceAttributeName,
String  destinationEntityName,
String  destinationAttributeName,
boolean  toMany,
int  deleteRule,
boolean  isMandatory,
boolean  isClassProperty,
boolean  shouldPropagatePrimaryKey 
) [static]

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

static String createSchemaSQLForEntitiesInDatabaseContext ( NSArray  entities,
EODatabaseContext  databaseContext,
boolean  create,
boolean  drop 
) [static]

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
Deprecated:

static String createSchemaSQLForEntitiesInModelWithName ( NSArray  entities,
String  modelName 
) [static]

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
Deprecated:

static String createSchemaSQLForEntitiesInModelWithNameAndOptions ( NSArray  entities,
String  modelName,
NSDictionary  optionsCreate 
) [static]

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
Deprecated:

static String createSchemaSQLForEntitiesInModelWithNameAndOptionsForOracle9 ( NSArray  entities,
String  modelName,
NSDictionary  optionsCreate 
) [static]

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

static String createSchemaSQLForEntitiesWithOptions ( NSArray  entities,
EODatabaseContext  databaseContext,
NSDictionary  optionsCreate 
) [static]

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 also:
createSchemaSQLForEntitiesInModelWithNameAndOptions)
Returns:
a sql script
Deprecated:

static EODatabaseContext databaseContextForEntityNamed ( EOObjectStoreCoordinator  osc,
String  entityName 
) [static]

Returns the database context for the given entity in the given EOObjectStoreCoordinator

Parameters:
entityName 
osc 

static EODatabaseContext databaseContextForObject ( EOEnterpriseObject  eo  )  [static]

Returns the database context for an EO.

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

static int deleteRowsDescribedByQualifier ( EOEditingContext  ec,
String  entityName,
final EOQualifier  qualifier 
) [static]

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 

static EOEntity destinationEntityForKeyPath ( EOEntity  entity,
String  keyPath 
) [static]

static EOEntity entityForEo ( EOEnterpriseObject  eo  )  [static]

Returns the EOEntity for the provided EOEnterpriseObject if one exists

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

static NSArray<EOEntity> entityHierarchyForEntity ( EOEditingContext  ec,
EOEntity  rootEntity 
) [static]

Parameters:
rootEntity 
Returns:
a list of all concrete entities that inherit from rootEntity, including rootEntity itself if it is concrete.

static NSArray<String> entityHierarchyNamesForEntityNamed ( EOEditingContext  ec,
String  rootEntityName 
) [static]

Parameters:
rootEntityName 
Returns:
a list of all concrete entity names that inherit from rootEntityName, including rootEntityName itself if it is concrete.

static EOEntity entityMatchingString ( EOEditingContext  ec,
String  string 
) [static]

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

static EOEntity entityNamed ( EOEditingContext  ec,
String  entityName 
) [static]

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

static boolean entityUsesSeparateTable ( EOEntity  entity  )  [static]

static EOEntity entityUsingTable ( EOEditingContext  ec,
String  tableName 
) [static]

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

static boolean entityWithNamedIsShared ( EOEditingContext  ec,
String  entityName 
) [static]

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
Exceptions:
IllegalStateException if the entityName provided is null

static void evaluateSQLWithEntity ( EOEditingContext  ec,
EOEntity  entity,
String  exp 
) [static]

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

static void evaluateSQLWithEntityNamed ( EOEditingContext  ec,
String  entityName,
String  exp 
) [static]

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

static <T> T executeAdaptorChannelOperation ( final String  modelName,
final int  maxAttempts,
final AdaptorChannelOperation< T >  operation 
) [static]

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.

Parameters:
<T> the type of the results of this operation
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

static <T> T executeAdaptorChannelOperation ( final EODatabaseContext  databaseContext,
final int  maxAttempts,
final AdaptorChannelOperation< T >  operation 
) [static]

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.

Parameters:
<T> the type of the results of this operation
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

static <T> T executeDatabaseContextOperation ( final EODatabaseContext  databaseContext,
final int  maxAttempts,
final DatabaseContextOperation< T >  operation 
) [static]

Executes the given database context operation within a database context lock, retrying up to maxRetryCount times if the database connection dropped.

Parameters:
<T> the type of the results of this operation
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

static NSArray externalNamesForEntity ( EOEntity  entity,
boolean  includeParentEntities 
) [static]

static NSArray externalNamesForEntityNamed ( String  entityName,
boolean  includeParentEntities 
) [static]

static Number getNextValFromSequenceNamed ( EOEditingContext  ec,
String  modelName,
String  sequenceName 
) [static]

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
Deprecated:

static String guessPluginName ( EOModel  model  )  [static]

Tries to get the plugin name for a JDBC based model.

Parameters:
model 

static String guessPluginNameForConnectionDictionary ( NSDictionary  connectionDictionary  )  [static]

Tries to get the plugin name for a connection dictionary.

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

static int insertRow ( EOEditingContext  ec,
String  entityName,
final NSDictionary  newValues 
) [static]

Insert row described dictionary.

Parameters:
ec 
entityName 
newValues 

static int insertRows ( EOEditingContext  ec,
String  entityName,
final Collection<?extends NSDictionary< String,?>>  newValues 
) [static]

Insert rows described the array of dictionaries.

Parameters:
ec 
entityName 
newValues 

static boolean isOptimisticLockingFailure ( EOGeneralAdaptorException  e  )  [static]

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.

static EORelationship lastRelationship ( EORelationship  relationship  )  [static]

Crude hack to get at the end of a relationship path.

Parameters:
relationship 

static EOFetchSpecification localizeFetchSpecification ( EOEditingContext  ec,
EOFetchSpecification  fetchSpecification 
) [static]

Returns a new fetch spec by morphing sort oderings containing the keys foo.name returning foo.name_de where appropriate.

Parameters:
ec 
fetchSpecification 

static void logExpression ( EOAdaptorChannel  channel,
EOSQLExpression  expression,
long  startTime 
) [static]

static void makeEditableSharedEntityNamed ( String  entityName  )  [static]

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.

static EOModelGroup modelGroup ( EOEditingContext  ec  )  [static]

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)

static NSDictionary primaryKeyDictionaryForEntity ( EOEditingContext  ec,
String  entityName 
) [static]

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.

static NSArray primaryKeysForNewRows ( EOEditingContext  ec,
String  entityName,
final int  count 
) [static]

Creates count new primary keys for the entity.

Parameters:
ec 
entityName 
count 

static NSArray primaryKeysForObjects ( NSArray  eos  )  [static]

Creates an array containing all of the primary keys of the given objects.

Parameters:
eos array of enterprise objects

static EOQualifier qualifierFromAttributes ( NSArray  attributes,
NSDictionary  values 
) [static]

Creates an AND qualifier of EOKeyValueQualifiers for every keypath in the given array of attributes.

Author:
ak

static NSArray rawRowsForSQLExpression ( EOEditingContext  ec,
EOModel  model,
EOSQLExpression  expression,
NSArray< EOAttribute >  attributes 
) [static]

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

static NSArray<NSDictionary> rawRowsForSQLExpression ( EOEditingContext  ec,
String  modelName,
EOSQLExpression  expression 
) [static]

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

static void reapplyChanges ( EOEnterpriseObject  eo,
EOGeneralAdaptorException  e 
) [static]

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.

static EOEnterpriseObject refetchFailedObject ( EOEditingContext  ec,
EOGeneralAdaptorException  e 
) [static]

static NSArray relationshipsForAttribute ( EOEntity  entity,
EOAttribute  attrib 
) [static]

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.

static EOEntity rootEntityForEntity ( EOEntity  entity  )  [static]

static EOEntity rootEntityForEntityNamed ( String  entityName  )  [static]

static int rowCountForFetchSpecification ( EOEditingContext  ec,
EOFetchSpecification  spec 
) [static]

Returns the number of rows the supplied EOFetchSpecification would return.

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

static void setIsAttributeUsedForLocking ( EOAttribute  attr,
boolean  isUsedForLocking 
) [static]

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

static void setIsClassProperty ( EOProperty  property,
boolean  isClassProperty 
) [static]

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.

static NSArray snapshotsForObjectsFromRelationshipNamed ( NSArray  eos,
String  relKey 
) [static]

Given an array of EOs, returns snapshot dictionaries for the given related objects.

static EOAttribute sourceAttributeForRelationship ( EORelationship  relationship  )  [static]

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

static EOAttribute sourceAttributeForRelationship ( EOEntity  entity,
String  relationshipName 
) [static]

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

static String sourceColumnForRelationship ( EORelationship  relationship  )  [static]

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

static String sourceColumnForRelationship ( EOEntity  entity,
String  relationshipName 
) [static]

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

static EOSQLExpression sqlExpressionForFetchSpecification ( EOEditingContext  ec,
EOFetchSpecification  spec,
long  start,
long  end 
) [static]

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

static String sqlForFetchSpecification ( EOEditingContext  ec,
EOFetchSpecification  spec 
) [static]

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

static String sqlWhereClauseStringForKey ( EOSQLExpression  e,
String  key,
NSArray  valueArray 
) [static]

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

Deprecated:

static int updateRowsDescribedByQualifier ( EOEditingContext  ec,
String  entityName,
final EOQualifier  qualifier,
final NSDictionary  newValues 
) [static]

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 

static NSSet verifyAllSnapshots (  )  [static]

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


Member Data Documentation

Set _keysWithWarning = Collections.synchronizedSet(new HashSet()) [static, private]

Returns the last entity for the given key path. If the path is empty or null, returns the given entity.

Parameters:
entity 
keyPath 

final Logger log = Logger.getLogger(ERXEOAccessUtilities.class) [static]

logging support

Logger sqlLoggingLogger = null [static, private]

SQL logger


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:43:10 2012 for Project Wonder by  doxygen 1.5.8