|
Project Wonder 2.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object er.extensions.ERXEOControlUtilities
Collection of EOF utility method centered around EOControl.
Field Summary | |
static ERXLogger |
log
logging support |
Constructor Summary | |
ERXEOControlUtilities()
|
Method Summary | |
static String |
_stringForPrimaryKey(Object pk)
Returns the propertylist-encoded string representation of the primary key for a given object. |
static void |
addObjectToObjectOnBothSidesOfRelationshipWithKey(EOEnterpriseObject addedObject,
EOEnterpriseObject referenceObject,
String key)
Adds an object to another objects relationship. |
static Number |
aggregateFunctionWithQualifier(EOEditingContext ec,
String entityName,
String attributeName,
String function,
EOQualifier qualifier)
Computes an aggregate function for a given attribute restricted by a given qualifier. |
static Number |
aggregateFunctionWithQualifier(EOEditingContext ec,
String entityName,
String attributeName,
String function,
String fetchSpecificationName,
NSDictionary bindings)
Computes an aggregate function for a given attribute restricted by a given qualifier. |
static NSArray |
arrayFromDataSource(EODataSource dataSource)
Converts a datasource into an array. |
static void |
clearSnapshotForRelationshipNamed(EOEnterpriseObject eo,
String relationshipName)
Clears snapshot the relaationship of a given enterprise so it will be read again when next accessed. |
static EOEnterpriseObject |
createAndAddObjectToRelationship(EOEditingContext editingContext,
EOEnterpriseObject source,
String relationshipName,
String destinationEntityName,
NSDictionary objectInfo)
Creates an object using the utility method createEO
from this utility class. |
static EOEnterpriseObject |
createAndInsertObject(EOEditingContext editingContext,
String entityName)
Creates an enterprise object for the given entity name by first looking up the class description of the entity to create the enterprise object. |
static EOEnterpriseObject |
createAndInsertObject(EOEditingContext editingContext,
String entityName,
NSDictionary objectInfo)
Creates an enterprise object for the given entity name by first looking up the class description of the entity to create the enterprise object. |
static EOArrayDataSource |
dataSourceForArray(NSArray array)
Simple utility method that will convert an array of enterprise objects into an EOArrayDataSource. |
static EODetailDataSource |
dataSourceForObjectAndKey(EOEnterpriseObject object,
String key)
Creates a detail data source for a given enterprise object and a relationship key. |
static EOEnterpriseObject |
editableInstanceOfObject(EOEnterpriseObject eo,
boolean createNestedContext)
Creates a new, editable instance of the supplied object. |
static NSArray |
faultsForGlobalIDsInEditingContext(NSArray gids,
EOEditingContext ec)
returns a NSArray containing EOEnterpriseObjects (actually faults...) for the provided EOGlobalIDs. |
static EOFetchSpecification |
fetchSpecificationNamedWithBindings(String entityName,
String fetchSpecificationName,
NSDictionary bindings)
Gets a fetch specification from a given entity. |
static NSArray |
globalIDsForObjects(NSArray eos)
returns a NSArray containing EOGlobalIDs from the provided eos. |
static boolean |
isNewObject(EOEnterpriseObject eo)
Tests if an enterprise object is a new object by looking to see if it is in the list of inserted objects for the editing context or if the editing context is null. |
static EOEnterpriseObject |
localInstanceOfObject(EOEditingContext ec,
EOEnterpriseObject eo)
This has one advantage over the standard EOUtilites method of first checking if the editingcontexts are equal before creating a fault for the object in the editing context. |
static EOQualifier |
localInstancesInQualifier(EOEditingContext ec,
EOQualifier q)
faults every EO in the qualifiers into the specified editingContext. |
static NSArray |
localInstancesOfObjects(EOEditingContext ec,
NSArray eos)
Provides the same functionality as the equivalent method in EOUtilities
except it will use the localInstanceOfObject
method from this utilities class which has a few enhancements. |
static NSDictionary |
newPrimaryKeyDictionaryForEntityNamed(EOEditingContext ec,
String entityName)
Utility method to generate a new primary key dictionary using the adaptor for a given entity. |
static NSDictionary |
newPrimaryKeyDictionaryForObject(EOEnterpriseObject eo)
Utility method to generate a new primary key for an object. |
static NSDictionary |
newPrimaryKeyDictionaryForObjectFromClassProperties(EOEnterpriseObject eo)
Utility method to generate a new primary key dictionary using the objects class properties. |
static Number |
objectCountUniqueWithQualifierAndAttribute(EOEditingContext ec,
String entityName,
EOQualifier qualifier,
String attributeName)
Returns the number of unique objects matching the given qualifier for a given entity name. |
static Number |
objectCountWithQualifier(EOEditingContext ec,
String entityName,
EOQualifier qualifier)
Returns the number of objects matching the given qualifier for a given entity name. |
static NSArray |
objectsInRange(EOEditingContext ec,
EOFetchSpecification spec,
int start,
int end)
Returns an NSArray containing the objects from the resulting rows starting
at start and stopping at end using a custom SQL, derived from the SQL
which the EOFetchSpecification would use normally setHints() |
static NSArray |
objectsWithQualifier(EOEditingContext ec,
String entityName,
EOQualifier qualifier,
NSArray prefetchKeyPaths,
boolean includeNewObjects)
Utility method used to fetch an array of objects given a qualifier. |
static NSArray |
objectsWithQualifierFormat(EOEditingContext ec,
String entityName,
String qualifierFormat,
NSArray args,
NSArray prefetchKeyPaths,
boolean includeNewObjects)
Enhanced version of the utility method found in EOUtilities. |
static EOEnterpriseObject |
objectWithPrimaryKeyValue(EOEditingContext ec,
String entityName,
Object primaryKeyValue,
NSArray prefetchingKeyPaths)
Fetches an enterprise object based on a given primary key value. |
static NSArray |
primaryKeyArrayForObject(EOEnterpriseObject obj)
Gives the primary key array for a given enterprise object. |
static NSDictionary |
primaryKeyDictionaryForString(EOEditingContext ec,
String entityName,
String string)
Returns the decoded dictionary for an propertylist encoded string representation of the primary key for a given object. |
static EOFetchSpecification |
primaryKeyFetchSpecificationForEntity(EOEditingContext ec,
String entityName,
EOQualifier eoqualifier,
NSArray sortOrderings,
NSArray additionalKeys)
Constructs a fetch specification that will only fetch the primary keys for a given qualifier. |
static Object |
primaryKeyObjectForObject(EOEnterpriseObject eo)
Returns either the single object the PK consist of or the NSArray of its values if the key is compound. |
static NSArray |
primaryKeysMatchingQualifier(EOEditingContext ec,
String entityName,
EOQualifier eoqualifier,
NSArray sortOrderings)
Fetches an array of primary keys matching a given qualifier and sorted with a given array of sort orderings. |
static String |
primaryKeyStringForObject(EOEnterpriseObject eo)
Returns the propertylist-encoded string representation of the primary key for a given object. |
static EOQualifier |
qualifierMatchingAnyKey(NSArray keys,
NSSelector selector,
Object value)
Creates an OR qualifier of EOKeyValueQualifiers for every keypath in the given array of keys. |
static void |
refaultObject(EOEnterpriseObject eo)
Turns a given enterprise object back into a fault. |
static EOEnterpriseObject |
sharedObjectMatchingKeyAndValue(String entityName,
String key,
Object value)
Finds an object in the shared editing context matching a key and value. |
static NSArray |
sharedObjectsForEntityNamed(String entityName)
Gets all of the shared objects for a given entity name. |
static NSArray |
sharedObjectsMatchingKeyAndValue(String entityName,
String key,
Object value)
Finds objects in the shared editing context matching a key and value. |
static EOEnterpriseObject |
sharedObjectWithFetchSpec(String entityName,
String fetchSpec)
Fetches a shared enterprise object for a given fetch specification from the default shared editing context. |
static EOEnterpriseObject |
sharedObjectWithPrimaryKey(String entityName,
Object primaryKey)
Gets the shared enterprise object with the given primary from the default shared editing context. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final ERXLogger log
Constructor Detail |
public ERXEOControlUtilities()
Method Detail |
public static NSArray localInstancesOfObjects(EOEditingContext ec, NSArray eos)
EOUtilities
except it will use the localInstanceOfObject
method from this utilities class which has a few enhancements.
ec
- editing context to pull local object copieseos
- array of enterprise objects
public static EOArrayDataSource dataSourceForArray(NSArray array)
array
- collection of objects to be turned into a
datasource
public static NSArray arrayFromDataSource(EODataSource dataSource)
dataSource
- data source to be converted
public static EODetailDataSource dataSourceForObjectAndKey(EOEnterpriseObject object, String key)
object
- that has the relationshipkey
- relationship key
public static EOEnterpriseObject editableInstanceOfObject(EOEnterpriseObject eo, boolean createNestedContext)
eo
- object for the new instancecreateNestedContext
- true, if we should create a nested context (otherwise we create a peer context)
public static EOEnterpriseObject localInstanceOfObject(EOEditingContext ec, EOEnterpriseObject eo)
ec
- editing context to get a local instance of the object ineo
- object to get a local copy of
public static EOEnterpriseObject createAndInsertObject(EOEditingContext editingContext, String entityName)
editingContext
- editingContext to insert the created object intoentityName
- name of the entity to be created.
public static EOEnterpriseObject createAndInsertObject(EOEditingContext editingContext, String entityName, NSDictionary objectInfo)
editingContext
- editingContext to insert the created object intoentityName
- name of the entity to be created.objectInfo
- dictionary of values pushed onto the object
before being inserted into the editing context.
public static EOEnterpriseObject createAndAddObjectToRelationship(EOEditingContext editingContext, EOEnterpriseObject source, String relationshipName, String destinationEntityName, NSDictionary objectInfo)
createEO
from this utility class. After creating the enterprise object it
is added to the relationship of the enterprise object passed in.
For instance:createAndAddObjectToRelationship(ec, foo, "toBars", "Bar", dictValues);
editingContext
- editing context to create the object insource
- enterprise object to whose relationship the newly created
object will be added.relationshipName
- relationship name of the enterprise object
that is passed in to which the newly created eo should be
added.destinationEntityName
- name of the entity of the object to be created.objectInfo
- dictionary of values to be set on the newly created
object before it is inserted into the editing context.
public static void addObjectToObjectOnBothSidesOfRelationshipWithKey(EOEnterpriseObject addedObject, EOEnterpriseObject referenceObject, String key)
addedObject
- object to be added to the relationshipreferenceObject
- object that has the relationshipkey
- relationship keypublic static void refaultObject(EOEnterpriseObject eo)
eo
- enterprise object to refaultpublic static void clearSnapshotForRelationshipNamed(EOEnterpriseObject eo, String relationshipName)
eo
- enterprise objectrelationshipName
- relationship namepublic static EOFetchSpecification primaryKeyFetchSpecificationForEntity(EOEditingContext ec, String entityName, EOQualifier eoqualifier, NSArray sortOrderings, NSArray additionalKeys)
ec
- editing context, only used to determine the entityentityName
- name of the entity, only used to determine the entityeoqualifier
- to construct the fetch spec withsortOrderings
- array of sort orderings to sort the result set
with.additionalKeys
- array of additional key paths to construct the
raw rows key paths to fetch.
public static NSArray primaryKeysMatchingQualifier(EOEditingContext ec, String entityName, EOQualifier eoqualifier, NSArray sortOrderings)
ec
- editing context to fetch intoentityName
- name of the entityeoqualifier
- to restrict matching primary keyssortOrderings
- array of sort orders to sort result set
public static EOEnterpriseObject objectWithPrimaryKeyValue(EOEditingContext ec, String entityName, Object primaryKeyValue, NSArray prefetchingKeyPaths)
ec
- editing context to fetch intoentityName
- name of the entityprimaryKeyValue
- primary key value. Compound primary keys are given as NSDictionaries.prefetchingKeyPaths
- key paths to fetch off of the eo
public static NSArray objectsInRange(EOEditingContext ec, EOFetchSpecification spec, int start, int end)
NSArray
containing the objects from the resulting rows starting
at start and stopping at end using a custom SQL, derived from the SQL
which the EOFetchSpecification
would use normally setHints()
ec
- editingcontext to fetch objects intospec
- fetch specification for the fetchstart
- end
-
public static Number objectCountWithQualifier(EOEditingContext ec, String entityName, EOQualifier qualifier)
ec
- editing context to use for the count qualificationentityName
- name of the entity to fetchqualifier
- to find the matching objects
public static Number objectCountUniqueWithQualifierAndAttribute(EOEditingContext ec, String entityName, EOQualifier qualifier, String attributeName)
ec
- editing context to use for the count qualificationentityName
- name of the entity to fetchqualifier
- to find the matching objects
public static Number aggregateFunctionWithQualifier(EOEditingContext ec, String entityName, String attributeName, String function, String fetchSpecificationName, NSDictionary bindings)
ec
- editing context used for the fetchentityName
- name of the entityattributeName
- attribute for the function to be performed onfunction
- name, ie MAX, MIN, AVG, etc.
public static Number aggregateFunctionWithQualifier(EOEditingContext ec, String entityName, String attributeName, String function, EOQualifier qualifier)
ec
- editing context used for the fetchentityName
- name of the entityattributeName
- attribute for the function to be performed onfunction
- name, ie MAX, MIN, AVG, etc.qualifier
- to restrict data set
public static EOEnterpriseObject sharedObjectMatchingKeyAndValue(String entityName, String key, Object value)
entityName
- name of the shared entitykey
- to match againstvalue
- value to match
public static NSArray sharedObjectsMatchingKeyAndValue(String entityName, String key, Object value)
entityName
- name of the shared entitykey
- to match againstvalue
- value to match
public static NSArray sharedObjectsForEntityNamed(String entityName)
entityName
- name of the shared entity
public static EOEnterpriseObject sharedObjectWithFetchSpec(String entityName, String fetchSpec)
fetchSpec
- name of the fetch specification on the
shared object.entityName
- name of the shared entity
public static EOEnterpriseObject sharedObjectWithPrimaryKey(String entityName, Object primaryKey)
entityName
- name of the entity
public static EOFetchSpecification fetchSpecificationNamedWithBindings(String entityName, String fetchSpecificationName, NSDictionary bindings)
entityName
- name of the entity that the fetch specification is bound tofetchSpecificationName
- name of the fetch specification
public static NSDictionary newPrimaryKeyDictionaryForObjectFromClassProperties(EOEnterpriseObject eo)
eo
- object in question
public static NSDictionary newPrimaryKeyDictionaryForObject(EOEnterpriseObject eo)
#newPrimaryKeyForObjectFromClassProperties(EOEnterpriseObject)
and if that returns null,
newPrimaryKeyDictionaryForEntityNamed(EOEditingContext, String)
public static NSDictionary newPrimaryKeyDictionaryForEntityNamed(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 String primaryKeyStringForObject(EOEnterpriseObject eo)
eo
- object to get the primary key for.
public static String _stringForPrimaryKey(Object pk)
pk
- the primary key
public static NSDictionary primaryKeyDictionaryForString(EOEditingContext ec, String entityName, String string)
public static Object primaryKeyObjectForObject(EOEnterpriseObject eo)
eo
- object to get the primary key for.
public static NSArray primaryKeyArrayForObject(EOEnterpriseObject obj)
EOUtilities
.
obj
- enterprise object to get the primary key array from.
public static NSArray objectsWithQualifierFormat(EOEditingContext ec, String entityName, String qualifierFormat, NSArray args, NSArray prefetchKeyPaths, boolean includeNewObjects)
ec
- editing context to fetch it intoentityName
- name of the entityqualifierFormat
- format of the qualifier stringargs
- qualifier argumentsprefetchKeyPaths
- prefetching key pathsincludeNewObjects
- option to include newly inserted objects in the result set
public static NSArray objectsWithQualifier(EOEditingContext ec, String entityName, EOQualifier qualifier, NSArray prefetchKeyPaths, boolean includeNewObjects)
ec
- editing context to fetch it intoentityName
- name of the entityprefetchKeyPaths
- prefetching key pathsincludeNewObjects
- option to include newly inserted objects in the result set
public static EOQualifier localInstancesInQualifier(EOEditingContext ec, EOQualifier q)
ec
- q
- public static NSArray globalIDsForObjects(NSArray eos)
public static NSArray faultsForGlobalIDsInEditingContext(NSArray gids, EOEditingContext ec)
gids
- the EOGlobalIDsec
- the EOEditingContext in which the EOEnterpriseObjects should be faulted
public static boolean isNewObject(EOEnterpriseObject eo)
eo
- enterprise object to check
public static EOQualifier qualifierMatchingAnyKey(NSArray keys, NSSelector selector, Object value)
keys
- selector
- value
-
|
Last updated: Do, Dez 9, 2004 12:46 PM CET | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |