|
Project Wonder 5.0.0.8795 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecter.extensions.eof.ERXEOControlUtilities
public class ERXEOControlUtilities
Collection of EOF utility method centered around EOControl.
| Field Summary | |
|---|---|
static Logger |
log
logging support |
| Constructor Summary | |
|---|---|
ERXEOControlUtilities()
|
|
| Method Summary | ||
|---|---|---|
static Object |
_aggregateFunctionWithQualifier(EOEditingContext ec,
String entityName,
String attributeName,
String function,
Class valueClass,
String valueType,
EOQualifier qualifier)
|
|
static Object |
_aggregateFunctionWithQualifierAndAggregateAttribute(EOEditingContext ec,
String entityName,
EOQualifier qualifier,
EOAttribute aggregateAttribute)
Returns the number of objects in the database with the qualifier and counting attribute. |
|
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 NSTimestamp |
aggregateTimestampWithQualifier(EOEditingContext ec,
String entityName,
String attributeName,
String function,
EOQualifier qualifier)
Computes an aggregate function for a given attribute restricted by a given qualifier. |
|
static EOQualifier |
andQualifier(EOQualifier q1,
EOQualifier q2)
Joins the given qualifiers with an AND. |
|
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 void |
clearSnapshotForRelationshipNamedInDatabase(EOEnterpriseObject eo,
String relationshipName,
EODatabase database)
Clears snapshot the relaationship of a given enterprise so it will be read again when next accessed. |
|
static Object |
convertEOtoGID(Object obj)
Given a dictionary, array, set, EO, etc, this will recursively turn EO's into GID's. |
|
static Object |
convertGIDtoEO(EOEditingContext editingContext,
Object obj)
Given a dictionary, array, set, EO, etc, this will recursively turn GID's into EO's. |
|
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(EOEditingContext ec,
String entityName,
NSArray array)
Simple utility method that will convert an array of enterprise objects into an EOArrayDataSource. Note that the datasource that is constructed uses the class description and editing context of the first object of the array. |
|
static EOArrayDataSource |
dataSourceForArray(NSArray<? extends EOEnterpriseObject> array)
Simple utility method that will convert an array of enterprise objects into an EOArrayDataSource. Note that the datasource that is constructed uses the class description and editing context of the first object of the array. |
|
static EODetailDataSource |
dataSourceForObjectAndKey(EOEnterpriseObject object,
String key)
Creates a detail data source for a given enterprise object and a relationship key. |
|
static NSMutableArray |
deletedObjects(EOEditingContext editingContext,
NSArray<String> entityNames,
EOQualifier qualifier)
Returns the array of objects of the given type that have been deleted from the editing context and match the given qualifier. |
|
static String |
destinationEntityNameForKeyPath(EOEnterpriseObject eo,
String keyPath)
Convenience to get the destination entity name from a key path of an object. |
|
static
|
distinctValuesForKeyPath(EOEditingContext editingContext,
String entityName,
String keyPath,
EOQualifier qualifier,
NSArray<EOSortOrdering> sortOrderings)
Returns an NSArray of distinct values available for the given entity and key path. |
|
static EOEnterpriseObject |
editableInstanceOfObject(EOEnterpriseObject eo,
boolean createNestedContext)
Creates a new, editable instance of the supplied object. |
|
static boolean |
eoEquals(EOEnterpriseObject firstEO,
EOEnterpriseObject secondEO)
Determines if two EOs are equal by comparing their EOGlobalIDs. |
|
static NSArray |
faultsForGlobalIDs(EOEditingContext ec,
NSArray gids)
returns a NSArray containing EOEnterpriseObjects (actually faults...) for the provided EOGlobalIDs. |
|
static NSArray |
faultsForRawRowsFromEntity(EOEditingContext ec,
NSArray primKeys,
String entityName)
|
|
static EOFetchSpecification |
fetchSpecificationNamedWithBindings(String entityName,
String fetchSpecificationName,
NSDictionary bindings)
Gets a fetch specification from a given entity. |
|
static EOGlobalID |
globalIDForString(EOEditingContext ec,
String entityName,
String string)
Returns the decoded global id for an propertylist encoded string representation of the primary key for a given object. |
|
static NSArray |
globalIDsForObjects(NSArray eos)
returns a NSArray containing EOGlobalIDs from the provided eos. |
|
static NSMutableArray |
insertedObjects(EOEditingContext editingContext,
NSArray<String> entityNames,
EOQualifier qualifier)
Returns the array of objects of the given type that have been inserted into the editing context and match the given qualifier. |
|
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. Note: An object that has been deleted will have it's editing context set to null which means this method would report true for an object that has been deleted from the database. |
|
static
|
localInstanceOfObject(EOEditingContext ec,
T 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
|
localInstancesOfObjects(EOEditingContext ec,
NSArray<T> 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 void |
makeQualifierTrue(EOQualifier qualifier,
Object obj)
Given a qualifier of EOAndQualifiers and EOKVQualifiers, make then evaluate to true on the given object. |
|
static NSDictionary<String,Object> |
newPrimaryKeyDictionaryForEntityNamed(EOEditingContext ec,
String entityName)
Utility method to generate a new primary key dictionary using the adaptor for a given entity. |
|
static NSDictionary<String,Object> |
newPrimaryKeyDictionaryForObject(EOEnterpriseObject eo)
Utility method to generate a new primary key for an object. |
|
static NSDictionary<String,Object> |
newPrimaryKeyDictionaryForObjectFromClassProperties(EOEnterpriseObject eo)
Utility method to generate a new primary key dictionary using the objects class properties. |
|
static Integer |
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 Integer |
objectCountWithQualifier(EOEditingContext ec,
String entityName,
EOQualifier qualifier)
Returns the number of objects matching the given qualifier for a given entity name. |
|
static NSArray |
objectsForFaults(EOEditingContext ec,
NSArray possibleFaults)
Triggers all faults in an efficient manner. |
|
static NSArray |
objectsForFaultWithSortOrderings(EOEditingContext ec,
NSArray possibleFaults,
NSArray sortOrderings)
Uses ERXEOControlUtilities.objectForFaults to turn the faults into objects, then does in memory
ordering with EOSortOrdering.EOSortOrdering.sortedArrayUsingKeyOrderArray() |
|
static NSArray |
objectsForGlobalIDs(EOEditingContext ec,
NSArray globalIDs)
Aggregate method for EOEditingContext.objectForGlobalID(). |
|
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)
Calls objectsWithQualifier(ec, entityName, qualifier, prefetchKeyPaths, includeNewObjects, false). |
|
static NSArray |
objectsWithQualifier(EOEditingContext _editingContext,
String _entityName,
EOQualifier _qualifier,
NSArray _prefetchKeyPaths,
boolean _includeNewObjects,
boolean _includeNewObjectsInParentEditingContext)
|
|
static NSArray |
objectsWithQualifier(EOEditingContext editingContext,
String entityName,
EOQualifier qualifier,
NSArray prefetchKeyPaths,
boolean includeNewObjects,
boolean includeNewObjectsInParentEditingContext,
boolean filterUpdatedObjects,
boolean removeDeletedObjects)
Utility method used to fetch an array of objects given a qualifier. |
|
static NSArray |
objectsWithQualifier(EOEditingContext editingContext,
String entityName,
EOQualifier qualifier,
NSArray prefetchKeyPaths,
NSArray sortOrderings,
boolean usesDistinct,
boolean isDeep,
NSDictionary hints,
boolean includeNewObjects,
boolean includeNewObjectsInParentEditingContext,
boolean filterUpdatedObjects,
boolean removeDeletedObjects)
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)
Calls objectsWithQualifierFormat(ec, entityName, qualifierFormat, args, prefetchKeyPaths, includeNewObjects, false) |
|
static NSArray |
objectsWithQualifierFormat(EOEditingContext ec,
String entityName,
String qualifierFormat,
NSArray args,
NSArray prefetchKeyPaths,
boolean includeNewObjects,
boolean includeNewObjectsInParentEditingContexts)
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 EOEnterpriseObject |
objectWithPrimaryKeyValue(EOEditingContext ec,
String entityName,
Object primaryKeyValue,
NSArray prefetchingKeyPaths,
boolean refreshRefetchedObjects)
Fetches an enterprise object based on a given primary key value. |
|
static EOEnterpriseObject |
objectWithQualifier(EOEditingContext editingContext,
String entityName,
EOQualifier qualifier)
Returns the single object of the given type matching the qualifier. |
|
static EOQualifier |
orQualifier(EOQualifier q1,
EOQualifier q2)
Joins the given qualifiers with an OR. |
|
static EOQualifier |
orQualifierForKeyPaths(NSArray keyPaths,
NSSelector selector,
NSArray values)
Creates an OR qualifier with the given selector for all the given key paths and all the given serach terms. |
|
static EOQualifier |
orQualifierForKeyPaths(NSArray keyPaths,
NSSelector selector,
Object value)
Creates an OR qualifier with the given selector for all the given key paths. |
|
static NSArray |
primaryKeyArrayForObject(EOEnterpriseObject obj)
Gives the primary key array for a given enterprise object. |
|
static NSDictionary<String,Object> |
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<EOSortOrdering> sortOrderings,
NSArray<String> 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<EOSortOrdering> sortOrderings)
Fetches an array of primary keys matching a given qualifier and sorted with a given array of sort orderings. |
|
static String |
primaryKeyStringForGlobalID(EOKeyGlobalID gid)
Returns the propertylist-encoded string representation of the global ID. |
|
static String |
primaryKeyStringForObject(EOEnterpriseObject eo)
Returns the propertylist-encoded string representation of the primary key for a given object. |
|
static NSArray |
primaryKeyValuesInRange(EOEditingContext ec,
EOFetchSpecification spec,
int start,
int end)
Returns an NSArray containing the primary keys 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 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 |
requiredObjectWithQualifier(EOEditingContext editingContext,
String entityName,
EOQualifier qualifier)
Returns the single object of the given type matching the qualifier. |
|
static EOEntity |
rootEntity(EOEnterpriseObject eo)
Returns the root entity from the EOEnterpriseObject |
|
static String |
rootEntityName(EOEnterpriseObject eo)
Returns the name from the root entity from the EOEnterpriseObject |
|
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 NSArray |
sharedObjectsWithFetchSpecificationNamed(String entityName,
String fetchSpecName)
|
|
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. |
|
static NSArray |
stringAttributeListForEntityNamed(EOEditingContext ec,
String entityName)
Calculates all of the EOAttributes of a given entity that are mapped to String objects. |
|
static void |
trimSpaces(EOEnterpriseObject object)
Trims all values from string attributes from the given EO. |
|
static NSMutableArray |
updatedObjects(EOEditingContext editingContext,
NSArray<String> entityNames,
EOQualifier qualifier)
Returns the array of objects of the given type that have been updated in the editing context and match the given qualifier. |
|
static void |
validateUniquenessOf(EOEnterpriseObject eo,
EOQualifier restrictingQualifier,
String... keys)
Convinience method which passes null for
entityName. |
|
static void |
validateUniquenessOf(EOEnterpriseObject eo,
String... keys)
Convinience method which passes null for
restrictingQualifier and entityName. |
|
static void |
validateUniquenessOf(String entityName,
EOEnterpriseObject eo,
EOQualifier restrictingQualifier,
String... keys)
Validates whether the values of the specified keyPaths are unique for an Entity. |
|
static void |
validateUniquenessOf(String entityName,
EOEnterpriseObject eo,
String... keys)
Convinience method which passes null for
restrictingQualifier. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Logger log
| Constructor Detail |
|---|
public ERXEOControlUtilities()
| Method Detail |
|---|
public static <T extends EOEnterpriseObject> NSArray<T> localInstancesOfObjects(EOEditingContext ec,
NSArray<T> 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<? extends EOEnterpriseObject> array)
array - collection of objects to be turned into a
datasource
public static EOArrayDataSource dataSourceForArray(EOEditingContext ec,
String entityName,
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 <T extends EOEnterpriseObject> T localInstanceOfObject(EOEditingContext ec,
T eo)
ec - editing context to get a local instance of the object ineo - object to get a local copy of
public static boolean eoEquals(EOEnterpriseObject firstEO,
EOEnterpriseObject secondEO)
firstEO - first EO to comparesecondEO - second EO to compare
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,