Project Wonder 2.0

er.extensions
Class ERXUtilities

java.lang.Object
  extended byer.extensions.ERXUtilities

public class ERXUtilities
extends Object

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.


Nested Class Summary
static interface ERXUtilities.BooleanCallback
          Generic boolean callback interface with a context object.
static interface ERXUtilities.BooleanOperation
          Useful interface for binding objects to WOComponent bindings where you want to delay the evaluation of the boolean operation until valueForBinding is actually called.
static interface ERXUtilities.Callback
          Generic callback interface with a context object.
static interface ERXUtilities.Operation
          Useful interface for binding objects to WOComponent bindings where you want to delay the evaluation of the operation until valueForBinding is actually called.
 
Field Summary
static NSTimestamp DISTANT_FUTURE
           
static NSTimestamp DISTANT_PAST
           
static ERXLogger log
          logging support
 
Constructor Summary
ERXUtilities()
           
 
Method Summary
static void addObjectToObjectOnBothSidesOfRelationshipWithKey(EOEnterpriseObject addedObject, EOEnterpriseObject referenceObject, String key)
          Deprecated. use ERXEOControlUtilities.addObjectToObjectOnBothSidesOfRelationshipWithKey(EOEnterpriseObject,EOEnterpriseObject,String)
static NSArray allFrameworkNames()
          Utility method to get all of the framework names that have been loaded into the application.
static NSArray allSubEntitiesForEntity(EOEntity entity, boolean includeAbstracts)
          Utility method used to find all of the sub entities for a given entity.
static NSArray arrayFromDataSource(EODataSource dataSource)
          Deprecated. see ERXEOControlUtilities.arrayFromDataSource(EODataSource)
static boolean booleanValue(Object obj)
          Deprecated. use ERXValueUtilities.booleanValue(Object)
static boolean booleanValueForBindingOnComponentWithDefault(String binding, WOComponent component, boolean def)
          Deprecated. use ERXValueUtilities.booleanValueForBindingOnComponentWithDefault(String,WOComponent,boolean) instead
static boolean booleanValueWithDefault(Object obj, boolean def)
          Deprecated. use ERXValueUtilities.booleanValueWithDefault(Object,boolean)
static EOEntity caseInsensitiveEntityNamed(String entityName)
          Finds an entity given a case insensitive search of all the entity names.
static EOEnterpriseObject createEO(String entityName, EOEditingContext editingContext)
          Deprecated. use ERXEOControlUtilities.createAndInsertObject(EOEditingContext,String)
static EOEnterpriseObject createEO(String entityName, EOEditingContext editingContext, NSDictionary objectInfo)
          Deprecated. use createAndInsertObject(EOEditingContext,String, NSDictionary)
static EOEnterpriseObject createEOLinkedToEO(String entityName, EOEditingContext editingContext, String relationshipName, EOEnterpriseObject eo)
          Deprecated. use ERXEOControlUtilities.createAndAddObjectToRelationship(EOEditingContext,EOEnterpriseObject,String,String,NSDictionary);
static EOEnterpriseObject createEOLinkedToEO(String entityName, EOEditingContext editingContext, String relationshipName, EOEnterpriseObject eo, NSDictionary objectInfo)
          Deprecated. use ERXEOControlUtilities.createAndAddObjectToRelationship(EOEditingContext,EOEnterpriseObject,String,String,NSDictionary);
static EOArrayDataSource dataSourceForArray(NSArray array)
          deprecated see ERXEOControlUtilities.dataSourceForArray(NSArray)
static NSArray deletedObjectsPKeys(EOEditingContext ec)
          Utility method for returning all of the primary keys for all of the objects that are marked for deletion in the editing context.
static void deleteObjects(EOEditingContext ec, NSArray objects)
          Simple utility method for deleting an array of objects from an editing context.
static void deplicateRelationshipFromEO(ERXGenericRecord r1, String relationshipName)
          Copies a relationship from one EO to another using the name of the relationship
static NSTimestamp distantFuture()
           
static NSTimestamp distantPast()
           
static NSArray entitiesForModelGroup(EOModelGroup group)
          Simple utility method for getting all of the entities for all of the models of a given model group.
static String escapeApostrophe(String aString)
          Gets rid of all ' from a String.
static NSTimestampFormatter gregorianDateFormatterForJavaDate()
          Utility method to return a standard timestamp formatter for the default string representation of java dates.
static NSArray intersectingElements(NSArray array1, NSArray array2)
          Performs a basic intersection between two arrays.
static EOEnterpriseObject localInstanceOfObject(EOEditingContext ec, EOEnterpriseObject eo)
          Deprecated. use ERXEOControlUtilities.localInstanceOfObject(EOEditingContext,EOEnterpriseObject);
static NSArray localInstancesOfObjects(EOEditingContext ec, NSArray eos)
          Deprecated. use ERXEOControlUtilities.localInstancesOfObjects(EOEditingContext,NSArray);
static void makeEditableSharedEntityNamed(String entityName)
          Utility method to make a shared entity editable.
static NSDictionary primaryKeyDictionaryForEntity(EOEditingContext ec, String entityName)
          Deprecated. use ERXEOAccessUtilities.primaryKeyDictionaryForEntity(EOEditingContext, String)
static NSDictionary relationshipEntityWithEntityAndKeyPath(EOEntity srcentity, String keyPath)
           
static EOEnterpriseObject relationshipObjectWithObjectAndKeyPath(EOEnterpriseObject object, String keyPath)
           
static EORelationship relationshipWithObjectAndKeyPath(EOEnterpriseObject object, String keyPath)
          Traverses a key path to return the last EORelationship object.
static void replicateDataFromEOToEO(ERXGenericRecord r1, ERXGenericRecord r2, NSArray attributeNames)
          Copies values from one EO to another using an array of Attributes
static void replicateRelationshipFromEOToEO(ERXGenericRecord r1, ERXGenericRecord r2, String relationshipName)
          Copies a relationship from one EO to another using the name of the relationship
static EOEntity rootParentEntityForEntity(EOEntity entity)
          Walks all of the parentEntity relationships to find the root entity.
static NSSet setFromArray(NSArray array)
          Deprecated. use ERXArrayUtilities.setFromArray(NSArray)
static EOEnterpriseObject sharedObjectWithFetchSpec(String fetchSpec, String entityName)
          Deprecated. use ERXEOControlUtilities.sharedObjectWithFetchSpec(String, String)
static EOEnterpriseObject sharedObjectWithPrimaryKey(Object pk, String entityName)
          Deprecated. use ERXEOControlUtilities.sharedObjectWithPrimaryKey(String, object)
static void sortEOsUsingSingleKey(NSMutableArray eos, String key)
          Deprecated. use ERXArrayUtilities.sortArrayWithKey(NSMutableArray,String) instead
static void sortEOsUsingSingleKey(NSMutableArray eos, String key, NSSelector selector)
          Deprecated. use ERXArrayUtilities.sortArrayWithKey(NSMutableArray,String,NSSelector) instead
static NSSelector sortSelectorWithKey(String key)
          Deprecated. use ERXArrayUtilities.sortSelectorWithKey(String)
static String stackTrace()
          Generates a string representation of the current stacktrace.
static String stackTrace(Throwable t)
          Converts a throwable's stacktrace into a string representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

public static ERXLogger log
logging support


DISTANT_FUTURE

public static final NSTimestamp DISTANT_FUTURE

DISTANT_PAST

public static final NSTimestamp DISTANT_PAST
Constructor Detail

ERXUtilities

public ERXUtilities()
Method Detail

addObjectToObjectOnBothSidesOfRelationshipWithKey

public static void addObjectToObjectOnBothSidesOfRelationshipWithKey(EOEnterpriseObject addedObject,
                                                                     EOEnterpriseObject referenceObject,
                                                                     String key)
Deprecated. use ERXEOControlUtilities.addObjectToObjectOnBothSidesOfRelationshipWithKey(EOEnterpriseObject,EOEnterpriseObject,String)


createEO

public static EOEnterpriseObject createEO(String entityName,
                                          EOEditingContext editingContext)
Deprecated. use ERXEOControlUtilities.createAndInsertObject(EOEditingContext,String)


createEO

public static EOEnterpriseObject createEO(String entityName,
                                          EOEditingContext editingContext,
                                          NSDictionary objectInfo)
Deprecated. use createAndInsertObject(EOEditingContext,String, NSDictionary)


createEOLinkedToEO

public static EOEnterpriseObject createEOLinkedToEO(String entityName,
                                                    EOEditingContext editingContext,
                                                    String relationshipName,
                                                    EOEnterpriseObject eo)
Deprecated. use ERXEOControlUtilities.createAndAddObjectToRelationship(EOEditingContext,EOEnterpriseObject,String,String,NSDictionary);


createEOLinkedToEO

public static EOEnterpriseObject createEOLinkedToEO(String entityName,
                                                    EOEditingContext editingContext,
                                                    String relationshipName,
                                                    EOEnterpriseObject eo,
                                                    NSDictionary objectInfo)
Deprecated. use ERXEOControlUtilities.createAndAddObjectToRelationship(EOEditingContext,EOEnterpriseObject,String,String,NSDictionary);


localInstanceOfObject

public static EOEnterpriseObject localInstanceOfObject(EOEditingContext ec,
                                                       EOEnterpriseObject eo)
Deprecated. use ERXEOControlUtilities.localInstanceOfObject(EOEditingContext,EOEnterpriseObject);


localInstancesOfObjects

public static NSArray localInstancesOfObjects(EOEditingContext ec,
                                              NSArray eos)
Deprecated. use ERXEOControlUtilities.localInstancesOfObjects(EOEditingContext,NSArray);


sharedObjectWithFetchSpec

public static EOEnterpriseObject sharedObjectWithFetchSpec(String fetchSpec,
                                                           String entityName)
Deprecated. use ERXEOControlUtilities.sharedObjectWithFetchSpec(String, String)


sharedObjectWithPrimaryKey

public static EOEnterpriseObject sharedObjectWithPrimaryKey(Object pk,
                                                            String entityName)
Deprecated. use ERXEOControlUtilities.sharedObjectWithPrimaryKey(String, object)


primaryKeyDictionaryForEntity

public static NSDictionary primaryKeyDictionaryForEntity(EOEditingContext ec,
                                                         String entityName)
Deprecated. use ERXEOAccessUtilities.primaryKeyDictionaryForEntity(EOEditingContext, String)


deletedObjectsPKeys

public static NSArray deletedObjectsPKeys(EOEditingContext ec)
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

makeEditableSharedEntityNamed

public static void makeEditableSharedEntityNamed(String entityName)
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.

dataSourceForArray

public static EOArrayDataSource dataSourceForArray(NSArray array)
deprecated see ERXEOControlUtilities.dataSourceForArray(NSArray)


arrayFromDataSource

public static NSArray arrayFromDataSource(EODataSource dataSource)
Deprecated. see ERXEOControlUtilities.arrayFromDataSource(EODataSource)


sortEOsUsingSingleKey

public static void sortEOsUsingSingleKey(NSMutableArray eos,
                                         String key)
Deprecated. use ERXArrayUtilities.sortArrayWithKey(NSMutableArray,String) instead


sortEOsUsingSingleKey

public static void sortEOsUsingSingleKey(NSMutableArray eos,
                                         String key,
                                         NSSelector selector)
Deprecated. use ERXArrayUtilities.sortArrayWithKey(NSMutableArray,String,NSSelector) instead


booleanValueForBindingOnComponentWithDefault

public static boolean booleanValueForBindingOnComponentWithDefault(String binding,
                                                                   WOComponent component,
                                                                   boolean def)
Deprecated. use ERXValueUtilities.booleanValueForBindingOnComponentWithDefault(String,WOComponent,boolean) instead


booleanValue

public static boolean booleanValue(Object obj)
Deprecated. use ERXValueUtilities.booleanValue(Object)


booleanValueWithDefault

public static boolean booleanValueWithDefault(Object obj,
                                              boolean def)
Deprecated. use ERXValueUtilities.booleanValueWithDefault(Object,boolean)


relationshipWithObjectAndKeyPath

public static EORelationship relationshipWithObjectAndKeyPath(EOEnterpriseObject object,
                                                              String keyPath)
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.

relationshipEntityWithEntityAndKeyPath

public static NSDictionary relationshipEntityWithEntityAndKeyPath(EOEntity srcentity,
                                                                  String keyPath)

relationshipObjectWithObjectAndKeyPath

public static EOEnterpriseObject relationshipObjectWithObjectAndKeyPath(EOEnterpriseObject object,
                                                                        String keyPath)

deleteObjects

public static void deleteObjects(EOEditingContext ec,
                                 NSArray objects)
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.

allFrameworkNames

public static NSArray allFrameworkNames()
Utility method to get all of the framework names that have been loaded into the application.

Returns:
array containing all of the framework names

intersectingElements

public static NSArray intersectingElements(NSArray array1,
                                           NSArray array2)
Performs a basic intersection between two arrays.

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

entitiesForModelGroup

public static NSArray entitiesForModelGroup(EOModelGroup group)
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.

caseInsensitiveEntityNamed

public static EOEntity caseInsensitiveEntityNamed(String entityName)
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.


allSubEntitiesForEntity

public static NSArray allSubEntitiesForEntity(EOEntity entity,
                                              boolean includeAbstracts)
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.

rootParentEntityForEntity

public static EOEntity rootParentEntityForEntity(EOEntity entity)
Walks all of the parentEntity relationships to find the root entity.

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

gregorianDateFormatterForJavaDate

public static NSTimestampFormatter gregorianDateFormatterForJavaDate()
Utility method to return a standard timestamp formatter for the default string representation of java dates.

Returns:
timestamp formatter for java dates.

stackTrace

public static String stackTrace()
Generates a string representation of the current stacktrace.

Returns:
current stacktrace.

stackTrace

public static String stackTrace(Throwable t)
Converts a throwable's stacktrace into a string representation.

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

distantFuture

public static NSTimestamp distantFuture()

distantPast

public static NSTimestamp distantPast()

escapeApostrophe

public static String escapeApostrophe(String aString)
Gets rid of all ' from a String.

Parameters:
aString - string to check
Returns:
string without '

setFromArray

public static NSSet setFromArray(NSArray array)
Deprecated. use ERXArrayUtilities.setFromArray(NSArray)


sortSelectorWithKey

public static NSSelector sortSelectorWithKey(String key)
Deprecated. use ERXArrayUtilities.sortSelectorWithKey(String)


replicateDataFromEOToEO

public static void replicateDataFromEOToEO(ERXGenericRecord r1,
                                           ERXGenericRecord r2,
                                           NSArray attributeNames)
Copies values from one EO to another using an array of Attributes


replicateRelationshipFromEOToEO

public static void replicateRelationshipFromEOToEO(ERXGenericRecord r1,
                                                   ERXGenericRecord r2,
                                                   String relationshipName)
Copies a relationship from one EO to another using the name of the relationship


deplicateRelationshipFromEO

public static void deplicateRelationshipFromEO(ERXGenericRecord r1,
                                               String relationshipName)
Copies a relationship from one EO to another using the name of the relationship


Last updated: Do, Dez 9, 2004 • 12:46 PM CET

Copyright © 2002 – 2004 Project Wonder.