public class ERXEOAccessUtilities extends Object
Modifier and Type | Class and Description |
---|---|
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.
|
Constructor and Description |
---|
ERXEOAccessUtilities() |
Modifier and Type | Method and Description |
---|---|
static NSArray<com.webobjects.eoaccess.EOEntity> |
allSubEntitiesForEntity(com.webobjects.eoaccess.EOEntity rootEntity,
boolean includeAbstracts)
Utility method used to find all of the sub entities
for a given entity.
|
static NSArray<com.webobjects.eoaccess.EOProperty> |
attributePathForKeyPath(com.webobjects.eoaccess.EOEntity entity,
String keyPath)
Creates an array of relationships and attributes from the given keypath to give to the
EOSQLExpression method
sqlStringForAttributePath . |
static EOAttribute |
attributeWithColumnNameFromEntity(String columnName,
com.webobjects.eoaccess.EOEntity entity) |
static void |
batchFetchRelationship(com.webobjects.eoaccess.EODatabaseContext databaseContext,
com.webobjects.eoaccess.EORelationship relationship,
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,
String entityName,
String relationshipName,
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 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 EOAttribute |
createAggregateAttribute(com.webobjects.eocontrol.EOEditingContext ec,
String function,
String attributeName,
String entityName)
Creates an aggregate integer attribute for a given function name.
|
static EOAttribute |
createAggregateAttribute(com.webobjects.eocontrol.EOEditingContext ec,
String function,
String attributeName,
String entityName,
Class valueClass,
String valueType)
Creates an aggregate attribute for a given function name.
|
static EOAttribute |
createAggregateAttribute(com.webobjects.eocontrol.EOEditingContext ec,
String function,
String attributeName,
String entityName,
Class valueClass,
String valueType,
String aggregateName)
Creates an aggregate attribute for a given function name.
|
static EOAttribute |
createAggregateAttribute(com.webobjects.eocontrol.EOEditingContext ec,
String function,
String attributeName,
String entityName,
Class valueClass,
String valueType,
String aggregateName,
String entityTableAlias)
Creates an aggregate attribute for a given function name.
|
static EOAttribute |
createAggregateAttribute(com.webobjects.eocontrol.EOEditingContext ec,
String function,
String attributeName,
String entityName,
Class valueClass,
String valueType,
String aggregateName,
String entityTableAlias,
boolean usesDistinct)
Creates an aggregate attribute for a given function name.
|
static com.webobjects.eoaccess.EORelationship |
createFlattenedRelationship(String relationshipName,
String sourceEntityName,
String definition,
int deleteRule,
boolean isMandatory,
boolean isClassProperty)
Programatically adds a flattened relationship to an entity at runtime.
|
static String |
createIndexSQLForEntities(NSArray entities)
Deprecated.
|
static String |
createIndexSQLForEntities(NSArray entities,
NSArray externalTypesToIgnore)
Deprecated.
|
static String |
createIndexSQLForEntitiesForOracle(NSArray entities)
Deprecated.
|
static String |
createLogString(com.webobjects.eoaccess.EOAdaptorChannel channel,
com.webobjects.eoaccess.EOSQLExpression expression,
long millisecondsNeeded) |
static com.webobjects.eoaccess.EORelationship |
createRelationship(String relationshipName,
String sourceEntityName,
String sourceAttributeName,
String destinationEntityName,
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 String |
createSchemaSQLForEntitiesInDatabaseContext(NSArray entities,
com.webobjects.eoaccess.EODatabaseContext databaseContext,
boolean create,
boolean drop)
Deprecated.
|
static String |
createSchemaSQLForEntitiesInModelWithName(NSArray entities,
String modelName)
Deprecated.
|
static String |
createSchemaSQLForEntitiesInModelWithNameAndOptions(NSArray entities,
String modelName,
NSDictionary optionsCreate)
Deprecated.
|
static String |
createSchemaSQLForEntitiesInModelWithNameAndOptionsForOracle9(NSArray entities,
String modelName,
NSDictionary optionsCreate)
Oracle 9 has a maximum length of 30 characters for table names, column names and constraint names.
|
static String |
createSchemaSQLForEntitiesWithOptions(NSArray entities,
com.webobjects.eoaccess.EODatabaseContext databaseContext,
NSDictionary optionsCreate)
Deprecated.
|
static com.webobjects.eoaccess.EODatabaseContext |
databaseContextForEntityNamed(com.webobjects.eocontrol.EOObjectStoreCoordinator osc,
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,
String entityName,
com.webobjects.eocontrol.EOQualifier qualifier)
Deletes rows described by the qualifier.
|
static com.webobjects.eoaccess.EOEntity |
destinationEntityForKeyPath(com.webobjects.eoaccess.EOEntity entity,
String keyPath)
Returns the last entity for the given key path.
|
static com.webobjects.eoaccess.EOEntity |
entityForEo(com.webobjects.eocontrol.EOEnterpriseObject eo)
Returns the EOEntity for the provided EOEnterpriseObject if one exists
|
static NSArray<com.webobjects.eoaccess.EOEntity> |
entityHierarchyForEntity(com.webobjects.eocontrol.EOEditingContext ec,
com.webobjects.eoaccess.EOEntity rootEntity)
Utility method used to find all of the non-abstract sub entities
for a given entity including itself.
|
static NSArray<String> |
entityHierarchyNamesForEntityNamed(com.webobjects.eocontrol.EOEditingContext ec,
String rootEntityName)
Utility method used to find all of the non-abstract sub entity names
for a given entity including itself.
|
static com.webobjects.eoaccess.EOEntity |
entityMatchingString(com.webobjects.eocontrol.EOEditingContext ec,
String string)
Finds an entity that is contained in a string.
|
static com.webobjects.eoaccess.EOEntity |
entityNamed(com.webobjects.eocontrol.EOEditingContext ec,
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,
String tableName)
Finds an entity that is associated with the table name.
|
static boolean |
entityWithNamedIsShared(com.webobjects.eocontrol.EOEditingContext ec,
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,
String exp)
Utility method used to execute arbitrary SQL.
|
static void |
evaluateSQLWithEntityNamed(com.webobjects.eocontrol.EOEditingContext ec,
String entityName,
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(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 NSArray |
externalNamesForEntity(com.webobjects.eoaccess.EOEntity entity,
boolean includeParentEntities) |
static NSArray |
externalNamesForEntityNamed(String entityName,
boolean includeParentEntities) |
static Number |
getNextValFromSequenceNamed(com.webobjects.eocontrol.EOEditingContext ec,
String modelName,
String sequenceName)
Deprecated.
|
static String |
guessPluginName(com.webobjects.eoaccess.EOModel model)
Tries to get the plugin name for a JDBC based model.
|
static String |
guessPluginNameForConnectionDictionary(NSDictionary connectionDictionary)
Tries to get the plugin name for a connection dictionary.
|
static int |
insertRow(com.webobjects.eocontrol.EOEditingContext ec,
String entityName,
NSDictionary newValues)
Insert row described dictionary.
|
static int |
insertRows(com.webobjects.eocontrol.EOEditingContext ec,
String entityName,
Collection<? extends NSDictionary<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 boolean |
isUniqueFailure(com.webobjects.eoaccess.EOGeneralAdaptorException e)
例外エラーが重複エラーの場合は true を戻します。
|
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 orderings 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(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 NSDictionary |
primaryKeyDictionaryForEntity(com.webobjects.eocontrol.EOEditingContext ec,
String entityName)
Utility method to generate a new primary key dictionary using the adaptor
for a given entity.
|
static NSArray |
primaryKeysForNewRows(com.webobjects.eocontrol.EOEditingContext ec,
String entityName,
int count)
Creates count new primary keys for the entity.
|
static NSArray |
primaryKeysForObjects(NSArray<? extends com.webobjects.eocontrol.EOEnterpriseObject> eos)
Creates an array containing all of the primary keys of the given objects.
|
static com.webobjects.eocontrol.EOQualifier |
qualifierFromAttributes(NSArray<EOAttribute> attributes,
NSDictionary values)
Creates an AND qualifier of EOKeyValueQualifiers for every keypath in the given array of attributes.
|
static NSArray |
rawRowsForSQLExpression(com.webobjects.eocontrol.EOEditingContext ec,
com.webobjects.eoaccess.EOModel model,
com.webobjects.eoaccess.EOSQLExpression expression,
NSArray<EOAttribute> attributes)
Returns the raw rows for the given EOSQLExpression.
|
static NSArray<NSDictionary> |
rawRowsForSQLExpression(com.webobjects.eocontrol.EOEditingContext ec,
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 NSArray<com.webobjects.eoaccess.EORelationship> |
relationshipsForAttribute(com.webobjects.eoaccess.EOEntity entity,
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)
Walks all of the parentEntity relationships to
find the root entity.
|
static com.webobjects.eoaccess.EOEntity |
rootEntityForEntityNamed(String entityName)
Walks all of the parentEntity relationships to
find the root entity.
|
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(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 void |
setListener(IERXEOExecutionListener aListener) |
static NSArray |
snapshotsForObjectsFromRelationshipNamed(NSArray eos,
String relKey)
Given an array of EOs, returns snapshot dictionaries for the given
related objects.
|
static EOAttribute |
sourceAttributeForRelationship(com.webobjects.eoaccess.EOEntity entity,
String relationshipName)
Returns the source attribute for the relationship named relationshipName on entity.
|
static EOAttribute |
sourceAttributeForRelationship(com.webobjects.eoaccess.EORelationship relationship)
Returns the source attribute for the relationship.
|
static String |
sourceColumnForRelationship(com.webobjects.eoaccess.EOEntity entity,
String relationshipName)
Returns the external column name for the source attribute for the relationship named relationshipName on entity.
|
static 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 String |
sqlForFetchSpecification(com.webobjects.eocontrol.EOEditingContext ec,
com.webobjects.eocontrol.EOFetchSpecification spec)
Creates the SQL which is used by the provides EOFetchSpecification.
|
static String |
sqlWhereClauseStringForKey(com.webobjects.eoaccess.EOSQLExpression e,
String key,
NSArray valueArray)
Deprecated.
|
static int |
updateRowsDescribedByQualifier(com.webobjects.eocontrol.EOEditingContext ec,
String entityName,
com.webobjects.eocontrol.EOQualifier qualifier,
NSDictionary newValues)
Updates rows described by the qualifier.
|
static 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.
|
public static final Logger log
public static void setListener(IERXEOExecutionListener aListener)
public static com.webobjects.eoaccess.EOEntity entityMatchingString(com.webobjects.eocontrol.EOEditingContext ec, String string)
ec
- editing contextstring
- string to look intonull
public static com.webobjects.eoaccess.EOEntity entityUsingTable(com.webobjects.eocontrol.EOEditingContext ec, String tableName)
ec
- editing contexttableName
- table (external) name to find an entity fornull
public static boolean entityWithNamedIsShared(com.webobjects.eocontrol.EOEditingContext ec, String entityName)
ec
- editing contextentityName
- name of the entityIllegalStateException
- if the entityName provided is null@Deprecated public static Number getNextValFromSequenceNamed(com.webobjects.eocontrol.EOEditingContext ec, String modelName, String sequenceName)
ec
- editing contextmodelName
- name of the model which connects to the database that has the
sequence in itsequenceName
- name of the sequencepublic static void evaluateSQLWithEntityNamed(com.webobjects.eocontrol.EOEditingContext ec, String entityName, String exp)
EOUtilities
rawRowsForSQL
in that it can be used with other statements
besides just SELECT without throwing exceptions.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 againstexp
- SQL expressionpublic static void evaluateSQLWithEntity(com.webobjects.eocontrol.EOEditingContext ec, com.webobjects.eoaccess.EOEntity entity, String exp)
EOUtilities
rawRowsForSQL
in that it can be used with other statements
besides just SELECT without throwing exceptions.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 againstexp
- SQL expressionpublic static String sqlForFetchSpecification(com.webobjects.eocontrol.EOEditingContext ec, com.webobjects.eocontrol.EOFetchSpecification spec)
ec
- the EOEditingContextspec
- the EOFetchSpecification in questionpublic static NSArray<NSDictionary> rawRowsForSQLExpression(com.webobjects.eocontrol.EOEditingContext ec, String modelName, com.webobjects.eoaccess.EOSQLExpression expression)
ec
- the EOEditingContextmodelName
- the name of the model in questionexpression
- the EOSQLExpression in questionpublic static NSArray rawRowsForSQLExpression(com.webobjects.eocontrol.EOEditingContext ec, com.webobjects.eoaccess.EOModel model, com.webobjects.eoaccess.EOSQLExpression expression, NSArray<EOAttribute> attributes)
ec
- the EOEditingContextmodel
- the model in questionexpression
- the EOSQLExpression to fetch withattributes
- the attributes to fetchpublic static com.webobjects.eoaccess.EOSQLExpression sqlExpressionForFetchSpecification(com.webobjects.eocontrol.EOEditingContext ec, com.webobjects.eocontrol.EOFetchSpecification spec, long start, long end)
ec
- the EOEditingContextspec
- the EOFetchSpecification in questionstart
- start of rows to fetchend
- end of rows to fetch (-1 if not used)public static int rowCountForFetchSpecification(com.webobjects.eocontrol.EOEditingContext ec, com.webobjects.eocontrol.EOFetchSpecification spec)
ec
- the EOEditingContextspec
- the EOFetchSpecification in questionpublic static com.webobjects.eoaccess.EOModelGroup modelGroup(com.webobjects.eocontrol.EOEditingContext ec)
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.ec
- editing context used to locate the model group (can be null
)public static com.webobjects.eoaccess.EOEntity entityNamed(com.webobjects.eocontrol.EOEditingContext ec, String entityName)
null
editingContext.ec
- editing context used to locate the model group (can be null
)entityName
- entity namepublic static EOAttribute createAggregateAttribute(com.webobjects.eocontrol.EOEditingContext ec, String function, String attributeName, String entityName)
ec
- editing context used to locate the model groupfunction
- name of the function MAX, MIN, etcattributeName
- name of the attributeentityName
- name of the entitypublic static EOAttribute createAggregateAttribute(com.webobjects.eocontrol.EOEditingContext ec, String function, String attributeName, String entityName, Class valueClass, String valueType)
ec
- editing context used to locate the model groupfunction
- name of the function MAX, MIN, etcattributeName
- name of the attributeentityName
- name of the entityvalueClass
- the java class of this attribute's valuesvalueType
- the EOAttribute value typepublic static EOAttribute createAggregateAttribute(com.webobjects.eocontrol.EOEditingContext ec, String function, String attributeName, String entityName, Class valueClass, String valueType, String aggregateName)
ec
- editing context used to locate the model groupfunction
- name of the function MAX, MIN, etcattributeName
- name of the attributeentityName
- name of the entityaggregateName
- the name to assign to the aggregate column in the queryvalueClass
- the java class of this attribute's valuesvalueType
- the EOAttribute value typepublic static EOAttribute createAggregateAttribute(com.webobjects.eocontrol.EOEditingContext ec, String function, String attributeName, String entityName, Class valueClass, String valueType, String aggregateName, String entityTableAlias)
ec
- editing context used to locate the model groupfunction
- name of the function MAX, MIN, etcattributeName
- name of the attributeentityName
- name of the entityaggregateName
- the name to assign to the aggregate column in the queryvalueClass
- the java class of this attribute's valuesvalueType
- the EOAttribute value typeentityTableAlias
- the "t0"-style name of the attribute in this query (or null for "t0")public static EOAttribute createAggregateAttribute(com.webobjects.eocontrol.EOEditingContext ec, String function, String attributeName, String entityName, Class valueClass, String valueType, String aggregateName, String entityTableAlias, boolean usesDistinct)
ec
- editing context used to locate the model groupfunction
- name of the function MAX, MIN, etcattributeName
- name of the attributeentityName
- name of the entityaggregateName
- the name to assign to the aggregate column in the queryvalueClass
- the java class of this attribute's valuesvalueType
- the EOAttribute value typeentityTableAlias
- the "t0"-style name of the attribute in this query (or null for "t0")usesDistinct
- true
if function should be used on distinct valuespublic static String createSchemaSQLForEntitiesInModelWithNameAndOptionsForOracle9(NSArray entities, String modelName, NSDictionary optionsCreate)
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 it is replaced with a unique name.
entities
- a NSArray containing the entities for which create table
statements should be generated or null
if all entities in the
model should be used.modelName
- the name of the EOModeloptionsCreate
- String
containing SQL statements to create
tablesERXSQLHelper.createSchemaSQLForEntitiesInModelWithNameAndOptions(NSArray, String, NSDictionary)
@Deprecated public static String createSchemaSQLForEntitiesInModelWithNameAndOptions(NSArray entities, String modelName, NSDictionary optionsCreate)
entities
- a NSArray containing the entities for which create table
statements should be generated or null if all entities in the
model should be used.modelName
- the name of the EOModeloptionsCreate
- a NSDictionary containing the different options. Possible keys
are
YES
and NO
String
containing SQL statements to create
tables@Deprecated public static String createSchemaSQLForEntitiesWithOptions(NSArray entities, com.webobjects.eoaccess.EODatabaseContext databaseContext, NSDictionary optionsCreate)
entities
- the entities to create sql fordatabaseContext
- the database context to useoptionsCreate
- the options (@see createSchemaSQLForEntitiesInModelWithNameAndOptions)@Deprecated public static String createSchemaSQLForEntitiesInModelWithName(NSArray entities, String modelName)
entities
- a NSArray containing the entities for which create table
statements should be generated or null if all entities in the
model should be used.modelName
- the name of the EOModelThis method uses the following defaults options:
YES
and NO
String
containing SQL statements to create
tables@Deprecated public static String createSchemaSQLForEntitiesInDatabaseContext(NSArray entities, com.webobjects.eoaccess.EODatabaseContext databaseContext, boolean create, boolean drop)
entities
- a NSArray containing the entities for which create table
statements should be generated or null if all entities in the
model should be used.databaseContext
- the databaseContextcreate
- if true, tables and keys are createddrop
- if true, tables and keys are droppedString
containing SQL statements to create
tables@Deprecated public static String createIndexSQLForEntitiesForOracle(NSArray entities)
@Deprecated public static String createIndexSQLForEntities(NSArray entities)
@Deprecated public static String createIndexSQLForEntities(NSArray entities, NSArray externalTypesToIgnore)
public static boolean entityUsesSeparateTable(com.webobjects.eoaccess.EOEntity entity)
public static EOAttribute attributeWithColumnNameFromEntity(String columnName, com.webobjects.eoaccess.EOEntity entity)
public static boolean isOptimisticLockingFailure(com.webobjects.eoaccess.EOGeneralAdaptorException e)
e
- the exception as recieved from saveChanges()public static boolean isUniqueFailure(com.webobjects.eoaccess.EOGeneralAdaptorException e)
e
- - saveChanges() から受けた例外エラーそのままpublic static NSArray snapshotsForObjectsFromRelationshipNamed(NSArray eos, String relKey)
public static NSDictionary primaryKeyDictionaryForEntity(com.webobjects.eocontrol.EOEditingContext ec, String entityName)
ERXGeneratesPrimaryKeyInterface
for more information about using
a newly created dictionary as the primary key for an enterprise object.ec
- editing contextentityName
- name of the entity to generate the primary key dictionary for.public static NSArray primaryKeysForObjects(NSArray<? extends com.webobjects.eocontrol.EOEnterpriseObject> eos)
eos
- array of enterprise objectspublic static com.webobjects.eoaccess.EORelationship lastRelationship(com.webobjects.eoaccess.EORelationship relationship)
relationship
- public static NSArray<com.webobjects.eoaccess.EOProperty> attributePathForKeyPath(com.webobjects.eoaccess.EOEntity entity, String keyPath)
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.entity
- base entitykeyPath
- key path@Deprecated public static String sqlWhereClauseStringForKey(com.webobjects.eoaccess.EOSQLExpression e, String key, NSArray valueArray)
public static com.webobjects.eoaccess.EODatabaseContext databaseContextForObject(com.webobjects.eocontrol.EOEnterpriseObject eo)
eo
- the EO to get a database context forpublic static com.webobjects.eoaccess.EODatabaseContext databaseContextForEntityNamed(com.webobjects.eocontrol.EOObjectStoreCoordinator osc, String entityName)
entityName
- entity nameosc
- the object store coordinatorpublic static boolean closeDatabaseConnections(com.webobjects.eocontrol.EOObjectStoreCoordinator osc)
osc
- the EOObjectStoreCoordinator from which the (JDBC)Connections
should be closedtrue
if all connections have been closedpublic static com.webobjects.eoaccess.EOEntity destinationEntityForKeyPath(com.webobjects.eoaccess.EOEntity entity, String keyPath)
null
, returns the given entity.entity
- keyPath
- public static com.webobjects.eoaccess.EOEntity entityForEo(com.webobjects.eocontrol.EOEnterpriseObject eo)
eo
- the EOEnterpriseObjectpublic static NSArray classPropertiesNotInParent(com.webobjects.eoaccess.EOEntity entity, boolean includeAttributes, boolean includeToOneRelationships, boolean includeToManyRelationships)
public static NSArray externalNamesForEntity(com.webobjects.eoaccess.EOEntity entity, boolean includeParentEntities)
public static NSArray externalNamesForEntityNamed(String entityName, boolean includeParentEntities)
public static com.webobjects.eoaccess.EOEntity rootEntityForEntity(com.webobjects.eoaccess.EOEntity entity)
entity
- to find the root parentpublic static com.webobjects.eoaccess.EOEntity rootEntityForEntityNamed(String entityName)
entityName
- to find the root parentpublic static void logExpression(com.webobjects.eoaccess.EOAdaptorChannel channel, com.webobjects.eoaccess.EOSQLExpression expression, long startTime)
public static String createLogString(com.webobjects.eoaccess.EOAdaptorChannel channel, com.webobjects.eoaccess.EOSQLExpression expression, long millisecondsNeeded)
public static com.webobjects.eocontrol.EOQualifier qualifierFromAttributes(NSArray<EOAttribute> attributes, NSDictionary values)
attributes
- values
- attributes
, EOKeyValueQualifier for a single element attributes
array, null
when attributes
is null or empty.public static NSArray<com.webobjects.eoaccess.EORelationship> relationshipsForAttribute(com.webobjects.eoaccess.EOEntity entity, EOAttribute attrib)
entity
- attrib
- EOAttribute to filter source attributes of
relationships.public static EOAttribute sourceAttributeForRelationship(com.webobjects.eoaccess.EOEntity entity, String relationshipName)
entity
- EOEntity to find relationship onrelationshipName
- name of relationship on entitypublic static EOAttribute sourceAttributeForRelationship(com.webobjects.eoaccess.EORelationship relationship)
relationship
- relationship on entity to return source attribute forpublic static String sourceColumnForRelationship(com.webobjects.eoaccess.EOEntity entity, String relationshipName)
entity
- EOEntity to find relationship onrelationshipName
- name of relationship on entitypublic static String sourceColumnForRelationship(com.webobjects.eoaccess.EORelationship relationship)
relationship
- relationship on entity to return the external column name for the source attribute forpublic static com.webobjects.eocontrol.EOEnterpriseObject refetchFailedObject(com.webobjects.eocontrol.EOEditingContext ec, com.webobjects.eoaccess.EOGeneralAdaptorException e)
public static void reapplyChanges(com.webobjects.eocontrol.EOEnterpriseObject eo, com.webobjects.eoaccess.EOGeneralAdaptorException e)
eo
- enterprise object to have the changes re-applied to.e
- public static int deleteRowsDescribedByQualifier(com.webobjects.eocontrol.EOEditingContext ec, String entityName, com.webobjects.eocontrol.EOQualifier qualifier)
ec
- entityName
- qualifier
- public static int updateRowsDescribedByQualifier(com.webobjects.eocontrol.EOEditingContext ec, String entityName, com.webobjects.eocontrol.EOQualifier qualifier, NSDictionary newValues)
ec
- entityName
- qualifier
- newValues
- public static int insertRow(com.webobjects.eocontrol.EOEditingContext ec, String entityName, NSDictionary newValues)
ec
- entityName
- newValues
- public static int insertRows(com.webobjects.eocontrol.EOEditingContext ec, String entityName, Collection<? extends NSDictionary<String,?>> newValues)
ec
- entityName
- newValues
- public static NSArray primaryKeysForNewRows(com.webobjects.eocontrol.EOEditingContext ec, String entityName, int count)
ec
- entityName
- count
- public static String guessPluginName(com.webobjects.eoaccess.EOModel model)
model
- model namenull
public static String guessPluginNameForConnectionDictionary(NSDictionary connectionDictionary)
connectionDictionary
- the connectionDictionary to guess a plugin name forpublic static com.webobjects.eocontrol.EOFetchSpecification localizeFetchSpecification(com.webobjects.eocontrol.EOEditingContext ec, com.webobjects.eocontrol.EOFetchSpecification fetchSpecification)
foo.name
returning foo.name_de
where appropriate.ec
- fetchSpecification
- public static void batchFetchRelationship(com.webobjects.eoaccess.EODatabaseContext databaseContext, String entityName, String relationshipName, NSArray objects, com.webobjects.eocontrol.EOEditingContext editingContext, boolean skipFaultedRelationships)
databaseContext
- the database context to fetch inentityName
- the name of the entity to fetch onrelationshipName
- the name of the relationship in that entity to fetchobjects
- the objects to fetch the relationship oneditingContext
- the editingContext to fetch inskipFaultedRelationships
- if true, skip any object whose relationship has already been faultedpublic static void batchFetchRelationship(com.webobjects.eoaccess.EODatabaseContext databaseContext, com.webobjects.eoaccess.EORelationship relationship, NSArray objects, com.webobjects.eocontrol.EOEditingContext editingContext, boolean skipFaultedRelationships)
databaseContext
- the database context to fetch inrelationship
- the relationship to fetchobjects
- the objects to fetch the relationship oneditingContext
- the editingContext to fetch inskipFaultedRelationships
- if true, skip any object whose relationship has already been
faultedpublic static NSSet verifyAllSnapshots()
public static void makeEditableSharedEntityNamed(String entityName)
entityName
- name of the shared entity to make
shareable.public static com.webobjects.eoaccess.EORelationship createRelationship(String relationshipName, String sourceEntityName, String sourceAttributeName, String destinationEntityName, String destinationAttributeName, boolean toMany, int deleteRule, boolean isMandatory, boolean isClassProperty, boolean shouldPropagatePrimaryKey)
relationshipName
- name of the relationship to be created on the source entitysourceEntityName
- name of the source entitysourceAttributeName
- name of the attribute in the source entity to be used by the joindestinationEntityName
- name of the destination entitydestinationAttributeName
- name of the attribute in the destination entity to be used by the jointoMany
- if true, the relationship will be toMany, otherwise it will be toOnedeleteRule
- EOClassDescription.DeleteRuleCascade ||
EOClassDescription.DeleteRuleDeny ||
EOClassDescription.DeleteRuleNoAction ||
EOClassDescription.DeleteRuleNullifyisMandatory
- mandatory or notisClassProperty
- class property or notshouldPropagatePrimaryKey
- propagate primary key or notpublic static com.webobjects.eoaccess.EORelationship createFlattenedRelationship(String relationshipName, String sourceEntityName, String definition, int deleteRule, boolean isMandatory, boolean isClassProperty)
relationshipName
- name of the relationship to be created on the source entitysourceEntityName
- name of the source entitydefinition
- data path of the relationship (e.g. department.facility)deleteRule
- EOClassDescription.DeleteRuleCascade ||
EOClassDescription.DeleteRuleDeny ||
EOClassDescription.DeleteRuleNoAction ||
EOClassDescription.DeleteRuleNullifyisMandatory
- mandatory or notisClassProperty
- class property or notpublic static <T> T executeDatabaseContextOperation(com.webobjects.eoaccess.EODatabaseContext databaseContext, int maxAttempts, ERXEOAccessUtilities.DatabaseContextOperation<T> operation)
T
- the type of the results of this operationdatabaseContext
- the (possibly unlocked) database context to operate onmaxAttempts
- the maximum number of times to reattempt the operation before failingoperation
- the database context operation to performpublic static <T> T executeAdaptorChannelOperation(com.webobjects.eoaccess.EODatabaseContext databaseContext, int maxAttempts, ERXEOAccessUtilities.AdaptorChannelOperation<T> operation)
T
- the type of the results of this operationdatabaseContext
- the (possibly unlocked) database context to operate onmaxAttempts
- the maximum number of times to reattempt the operation before failingoperation
- the adaptor channel operation to performpublic static <T> T executeAdaptorChannelOperation(String modelName, int maxAttempts, ERXEOAccessUtilities.AdaptorChannelOperation<T> operation)
T
- the type of the results of this operationmodelName
- the name of the model to lookup a database context formaxAttempts
- the maximum number of times to reattempt the operation before failingoperation
- the adaptor channel operation to performpublic static void setIsClassProperty(com.webobjects.eoaccess.EOProperty property, boolean isClassProperty)
property
- The property to add or remove from the class properties arrayisClassProperty
- true adds the property to the list of class properties,
false removes it.public static void setIsAttributeUsedForLocking(EOAttribute attr, boolean isUsedForLocking)
attr
- the attribute to add or removeisUsedForLocking
- true adds the attribute, false removes itpublic static NSArray<String> entityHierarchyNamesForEntityNamed(com.webobjects.eocontrol.EOEditingContext ec, String rootEntityName)
ec
- editing contextrootEntityName
- name of entity to walk all of the subEntities
relationshipspublic static NSArray<com.webobjects.eoaccess.EOEntity> entityHierarchyForEntity(com.webobjects.eocontrol.EOEditingContext ec, com.webobjects.eoaccess.EOEntity rootEntity)
ec
- editing contextrootEntity
- to walk all of the subEntities
relationshipspublic static NSArray<com.webobjects.eoaccess.EOEntity> allSubEntitiesForEntity(com.webobjects.eoaccess.EOEntity rootEntity, boolean includeAbstracts)
rootEntity
- to walk all of the subEntities
relationshipsincludeAbstracts
- determines if abstract entities should
be included in the returned arrayCopyright © 2002 – 2020 Project Wonder.