ERXUtilities Class Reference

Collaboration diagram for ERXUtilities:

Collaboration graph
[legend]

List of all members.

Classes

interface  BooleanCallback
interface  BooleanOperation
interface  Callback
interface  Operation

Static Public Member Functions

static void addObjectToObjectOnBothSidesOfRelationshipWithKey (EOEnterpriseObject addedObject, EOEnterpriseObject referenceObject, String key)
static NSArray allFrameworkNames ()
static NSArray allSubEntitiesForEntity (EOEntity entity, boolean includeAbstracts)
static EOEntity caseInsensitiveEntityNamed (String entityName)
static EOEnterpriseObject createEO (String entityName, EOEditingContext editingContext, NSDictionary objectInfo)
static EOEnterpriseObject createEO (String entityName, EOEditingContext editingContext)
static EOEnterpriseObject createEOLinkedToEO (String entityName, EOEditingContext editingContext, String relationshipName, EOEnterpriseObject eo, NSDictionary objectInfo)
static EOEnterpriseObject createEOLinkedToEO (String entityName, EOEditingContext editingContext, String relationshipName, EOEnterpriseObject eo)
static EOArrayDataSource dataSourceForArray (NSArray array)
static< T > T deepClone (T obj, boolean onlyCollections)
static NSArray deletedObjectsPKeys (EOEditingContext ec)
static void deleteObjects (EOEditingContext ec, NSArray objects)
static void deplicateRelationshipFromEO (EOEnterpriseObject r1, String relationshipName)
static NSTimestamp distantFuture ()
static NSTimestamp distantPast ()
static NSArray entitiesForModelGroup (EOModelGroup group)
static String escapeApostrophe (String aString)
static NSTimestampFormatter gregorianDateFormatterForJavaDate ()
static NSArray intersectingElements (NSArray array1, NSArray array2)
static EOEnterpriseObject localInstanceOfObject (EOEditingContext ec, EOEnterpriseObject eo)
static NSArray localInstancesOfObjects (EOEditingContext ec, NSArray eos)
static void makeEditableSharedEntityNamed (String entityName)
static NSDictionary primaryKeyDictionaryForEntity (EOEditingContext ec, String entityName)
static NSDictionary relationshipEntityWithEntityAndKeyPath (EOEntity srcentity, String keyPath)
static EOEnterpriseObject relationshipObjectWithObjectAndKeyPath (EOEnterpriseObject object, String keyPath)
static EORelationship relationshipWithObjectAndKeyPath (EOEnterpriseObject object, String keyPath)
static void replicateDataFromEOToEO (EOEnterpriseObject r1, EOEnterpriseObject r2, NSArray attributeNames)
static void replicateRelationshipFromEOToEO (EOEnterpriseObject r1, EOEnterpriseObject r2, String relationshipName)
static EOEntity rootParentEntityForEntity (EOEntity entity)
static NSSet setFromArray (NSArray array)
static EOEnterpriseObject sharedObjectWithFetchSpec (String fetchSpec, String entityName)
static EOEnterpriseObject sharedObjectWithPrimaryKey (Object pk, String entityName)
static NSSelector sortSelectorWithKey (String key)
static String stackTrace (Throwable t)
static String stackTrace ()

Static Public Attributes

static final NSTimestamp DISTANT_FUTURE = new NSTimestamp(2999,1,1,1,1,1,TimeZone.getDefault())
static final NSTimestamp DISTANT_PAST = new NSTimestamp(1000,1,1,1,1,1,TimeZone.getDefault())
static final Logger log = Logger.getLogger(ERXUtilities.class)

Static Private Attributes

static NSDictionary< String,
EOEntity > 
_entityNameEntityCache
static NSTimestampFormatter _gregorianDateFormatterForJavaDate


Detailed Description

Diverse collection of utility methods for handling everything from EOF to foundation. In the future this class will most likely be split into more meaning full groups of utility methods.

Member Function Documentation

static void addObjectToObjectOnBothSidesOfRelationshipWithKey ( EOEnterpriseObject  addedObject,
EOEnterpriseObject  referenceObject,
String  key 
) [static]

static NSArray allFrameworkNames (  )  [static]

Utility method to get all of the framework names that have been loaded into the application.

Returns:
array containing all of the framework names

static NSArray allSubEntitiesForEntity ( EOEntity  entity,
boolean  includeAbstracts 
) [static]

Utility method used to find all of the sub entities for a given entity.

Parameters:
entity to walk all of the subEntities relationships
includeAbstracts determines if abstract entities should be included in the returned array
Returns:
all of the sub-entities for a given entity.

static EOEntity caseInsensitiveEntityNamed ( String  entityName  )  [static]

Finds an entity given a case insensitive search of all the entity names.
Note: The current implementation caches the entity-entity name pair in an insensitive manner. This means that all of the models should be loaded before this method is called.

static EOEnterpriseObject createEO ( String  entityName,
EOEditingContext  editingContext,
NSDictionary  objectInfo 
) [static]

Deprecated:
use createAndInsertObject(EOEditingContext,String, NSDictionary)

static EOEnterpriseObject createEO ( String  entityName,
EOEditingContext  editingContext 
) [static]

static EOEnterpriseObject createEOLinkedToEO ( String  entityName,
EOEditingContext  editingContext,
String  relationshipName,
EOEnterpriseObject  eo,
NSDictionary  objectInfo 
) [static]

static EOEnterpriseObject createEOLinkedToEO ( String  entityName,
EOEditingContext  editingContext,
String  relationshipName,
EOEnterpriseObject  eo 
) [static]

static EOArrayDataSource dataSourceForArray ( NSArray  array  )  [static]

static <T> T deepClone ( obj,
boolean  onlyCollections 
) [static]

Returns a deep clone of the given object. A deep clone will attempt to clone any contained values (in the case of an NSArray or NSDictionary) as well as the value itself.

Parameters:
obj the object to clone
onlyCollections if true, only collections will be cloned, not individual values
Returns:
a deep clone of obj

static NSArray deletedObjectsPKeys ( EOEditingContext  ec  )  [static]

Utility method for returning all of the primary keys for all of the objects that are marked for deletion in the editing context.

Parameters:
ec editing context
Returns:
an array containing all of the dictionaries of primary keys for all of the objects marked for deletion

static void deleteObjects ( EOEditingContext  ec,
NSArray  objects 
) [static]

Simple utility method for deleting an array of objects from an editing context.

Parameters:
ec editing context to have objects deleted from
objects objects to be deleted.

static void deplicateRelationshipFromEO ( EOEnterpriseObject  r1,
String  relationshipName 
) [static]

Copies a relationship from one EO to another using the name of the relationship

static NSTimestamp distantFuture (  )  [static]

static NSTimestamp distantPast (  )  [static]

static NSArray entitiesForModelGroup ( EOModelGroup  group  )  [static]

Simple utility method for getting all of the entities for all of the models of a given model group.

Parameters:
group eo model group
Returns:
array of all entities for a given model group.

static String escapeApostrophe ( String  aString  )  [static]

Gets rid of all ' from a String.

Parameters:
aString string to check
Returns:
string without '

static NSTimestampFormatter gregorianDateFormatterForJavaDate (  )  [static]

Utility method to return a standard timestamp formatter for the default string representation of java dates.

Returns:
timestamp formatter for java dates.

static NSArray intersectingElements ( NSArray  array1,
NSArray  array2 
) [static]

Performs a basic intersection between two arrays.

Parameters:
array1 first array
array2 second array
Returns:
array containing the intersecting elements of the two arrays.

static EOEnterpriseObject localInstanceOfObject ( EOEditingContext  ec,
EOEnterpriseObject  eo 
) [static]

Deprecated:
use ERXEOControlUtilities.localInstanceOfObject(EOEditingContext,EOEnterpriseObject);

static NSArray localInstancesOfObjects ( EOEditingContext  ec,
NSArray  eos 
) [static]

Deprecated:
use ERXEOControlUtilities.localInstancesOfObjects(EOEditingContext,NSArray);

static void makeEditableSharedEntityNamed ( String  entityName  )  [static]

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

static NSDictionary relationshipEntityWithEntityAndKeyPath ( EOEntity  srcentity,
String  keyPath 
) [static]

static EOEnterpriseObject relationshipObjectWithObjectAndKeyPath ( EOEnterpriseObject  object,
String  keyPath 
) [static]

static EORelationship relationshipWithObjectAndKeyPath ( EOEnterpriseObject  object,
String  keyPath 
) [static]

Traverses a key path to return the last EORelationship object.
Note: that this method uses the object and not the model to traverse the key path, this has the added benefit of handling EOF inheritance

Parameters:
object enterprise object to find the relationship off of
keyPath key path used to find the relationship
Returns:
relationship object corresponding to the last property key of the key path.

static void replicateDataFromEOToEO ( EOEnterpriseObject  r1,
EOEnterpriseObject  r2,
NSArray  attributeNames 
) [static]

Copies values from one EO to another using an array of Attributes

static void replicateRelationshipFromEOToEO ( EOEnterpriseObject  r1,
EOEnterpriseObject  r2,
String  relationshipName 
) [static]

Copies a relationship from one EO to another using the name of the relationship

static EOEntity rootParentEntityForEntity ( EOEntity  entity  )  [static]

Walks all of the parentEntity relationships to find the root entity.

Parameters:
entity to find the root parent
Returns:
root parent entity

static NSSet setFromArray ( NSArray  array  )  [static]

Deprecated:
use ERXArrayUtilities.setFromArray(NSArray)

static EOEnterpriseObject sharedObjectWithFetchSpec ( String  fetchSpec,
String  entityName 
) [static]

static EOEnterpriseObject sharedObjectWithPrimaryKey ( Object  pk,
String  entityName 
) [static]

Deprecated:
use ERXEOControlUtilities.sharedObjectWithPrimaryKey(String, object)

static NSSelector sortSelectorWithKey ( String  key  )  [static]

static String stackTrace ( Throwable  t  )  [static]

Converts a throwable's stacktrace into a string representation.

Parameters:
t throwable to print to a string
Returns:
string representation of stacktrace

static String stackTrace (  )  [static]

Generates a string representation of the current stacktrace.

Returns:
current stacktrace.


Member Data Documentation

NSDictionary<String, EOEntity> _entityNameEntityCache [static, private]

entity name cache

NSTimestampFormatter _gregorianDateFormatterForJavaDate [static, private]

caches date formatter the first time it is used

final NSTimestamp DISTANT_FUTURE = new NSTimestamp(2999,1,1,1,1,1,TimeZone.getDefault()) [static]

final NSTimestamp DISTANT_PAST = new NSTimestamp(1000,1,1,1,1,1,TimeZone.getDefault()) [static]

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

logging support


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

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