|
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.ERXExtensions
Principal class of the ERExtensions framework. This class will be loaded at runtime when the ERExtensions bundle is loaded (even before the Application construcor is called) This class has a boat-load of stuff in it that will hopefully be finding better homes in the future. This class serves as the initilization point of this framework, look in the static initializer to see all the stuff that is initially setup when this class is loaded. This class also has a boat load of string, array and eof utilities as well as the factory methods for creating editing contexts with the default delegates set.
Nested Class Summary | |
static class |
ERXExtensions.Observer
This public observer is used to perform basic functions in response to notifications. |
Field Summary | |
static ERXLogger |
adaptorLogger
logging support for the adaptor channel |
static String |
objectsWillChangeInEditingContext
Notification name, posted before object will change in an editing context |
static ERXExtensions.Observer |
observer
|
static ERXLogger |
sharedEOadaptorLogger
logging support for shared object loading |
Constructor Summary | |
ERXExtensions()
|
Method Summary | |
static void |
addObjectsFromArrayWithoutDuplicates(NSMutableArray a1,
NSArray a2)
Deprecated. use ERXArrayUtilities.addObjectsFromArrayWithoutDuplicates |
static void |
addObjectToBothSidesOfPotentialRelationshipFromObjectWithKeyPath(EOEnterpriseObject to,
EOEnterpriseObject from,
String keyPath)
This method handles 3 different cases 1. keyPath is a single key and represents a relationship --> addObjectToBothSidesOfRelationshipWithKey 2. keyPath is a single key and does NOT represents a relationship 3. keyPath is a real key path: break it up, navigate to the last atom --> back to 1. or 2. |
static void |
addRandomizeDirectActionURL(StringBuffer daURL)
This method can be used with Direct Action URLs to make sure that the browser will reload the page. |
static String |
addWosidFormValue(String url,
WOSession s)
Adds the wosid for a given session to a given url. |
static NSArray |
arrayByAddingObjectsFromArrayWithoutDuplicates(NSArray a1,
NSArray a2)
Deprecated. use ERXArrayUtilities.arrayByAddingObjectsFromArrayWithoutDuplicates |
static NSArray |
arrayFromDataSource(EODataSource dataSource)
Deprecated. see ERXEOControlUtilities#arrayFromDataSource(NSArray) |
static NSArray |
arrayMinusArray(NSArray main,
NSArray minus)
Deprecated. use ERXArrayUtilities.arrayMinusArray |
static boolean |
arraysAreIdenticalSets(NSArray a1,
NSArray a2)
Deprecated. use ERXArrayUtilities.arraysAreIdenticalSets(NSArray, NSArray) |
static NSArray |
arrayWithoutDuplicateKeyValue(NSArray eos,
String key)
Deprecated. use ERXArrayUtilities.arrayWithoutDuplicateKeyValue |
static NSArray |
arrayWithoutDuplicates(NSArray anArray)
Deprecated. use ERXArrayUtilities.arrayWithoutDuplicates |
static boolean |
booleanFlagOnSessionForKeyWithDefault(WOSession s,
String key,
boolean defaultValue)
Retrieves a value from the session's dictionary and evaulates that object using the method booleanValue off of
ERXUtilities . |
static String |
byteArrayToHexString(byte[] data)
Deprecated. use ERXStringUtilities.byteArrayToHexString instead |
static byte[] |
bytesFromFile(File f)
Returns the byte array for a given file. |
static String |
capitalize(String s)
Capitalizes the given string. |
static String |
cleanString(String newString,
NSArray toBeCleaneds)
Removes any occurances of any strings in the array passed in from the string passed in. |
static void |
configureAdaptorContext()
This method is called by the delegate when the configuration file is changed. |
static void |
configureAdaptorContextRapidTurnAround(Object observer)
Configures the passed in observer to register a call back when the configuration file is changed. |
static EOArrayDataSource |
dataSourceForArray(NSArray array)
Deprecated. see ERXEOControlUtilities.dataSourceForArray(NSArray) |
static EODetailDataSource |
dataSourceForObjectAndKey(EOEnterpriseObject eo,
String key)
Deprecated. see ERXEOControlUtilities#arrayFromDataSource(NSArray) |
static ERXECNoValidationDelegate |
defaultECNoValidationDelegate()
Deprecated. see ERXEC |
static ERXEditingContextDelegate |
defaultEditingContextDelegate()
Deprecated. see ERXEC |
static String |
emptyStringForNull(String s)
Deprecated. use {@link ERXStringUtilities#emptyStringForNull(String) |
static NSDictionary |
eosInArrayGroupedByKeyPath(NSArray eos,
String keyPath)
Deprecated. use ERXArrayUtilities.arrayGroupedByKeyPath |
static NSDictionary |
eosInArrayGroupedByKeyPath(NSArray eos,
String keyPath,
boolean includeNulls,
String extraKeyPathForValues)
Deprecated. use ERXArrayUtilities.arrayGroupedByKeyPath |
static void |
evaluateSQLWithEntityNamed(String entityName,
String exp,
EOEditingContext ec)
Deprecated. see { @link ERXEOAccessUtilities#evaluateSQLWithEntityNamed} |
static NSArray |
filteredArrayWithQualifierEvaluation(NSArray a,
EOQualifierEvaluation q)
Deprecated. use ERXArrayUtilities.filteredArrayWithQualifierEvaluation |
static NSArray |
flatten(NSArray array)
Deprecated. use ERXArrayUtilities.flatten |
static void |
forceGC(int maxLoop)
Forces the garbage collector to run. |
static void |
freeProcessResources(Process p)
Frees all of a resources associated with a given process and then destroys it. |
static String |
friendlyEOArrayDisplayForKey(NSArray list,
String attribute,
String nullArrayDisplay)
Deprecated. use {@link ERXArrayUtilities#friendlyDisplayForKeyPath(NSArray, String, String, String, String) |
static byte[] |
hexStringToByteArray(String s)
Deprecated. ERXStringUtilities.hexStringToByteArray |
static ERXSimpleHTMLFormatter |
htmlFormatter()
|
static int |
intFromParseableIntegerString(String s)
Returns an integer from a parsable string. |
static boolean |
isNewObject(EOEnterpriseObject eo)
Deprecated. use ERXEOControlUtilities.isNewObject(EOEnterpriseObject) |
static long |
lastModifiedDateForFileInFramework(String fileName,
String frameworkName)
Determines the last modification date for a given file in a framework. |
static Logger |
log()
creates and caches the logging logger |
static EOEditingContext |
newEditingContext()
Deprecated. see ERXEC |
static EOEditingContext |
newEditingContext(boolean validation)
Deprecated. see ERXEC |
static EOEditingContext |
newEditingContext(EOObjectStore objectStore)
Deprecated. see ERXEC |
static EOEditingContext |
newEditingContext(EOObjectStore objectStore,
boolean validation)
Deprecated. see ERXEC |
static String |
nullForEmptyString(String s)
Deprecated. use {@link ERXStringUtilities#nullForEmptyString(String) |
static int |
numberOfOccurrencesOfCharInString(char c,
String s)
Deprecated. use {@link ERXStringUtilities#numberOfOccurrencesOfCharInString(char,String) |
static boolean |
objectImplementsMethod(Object object,
String methodName,
Class[] parameters)
Determines if a given object implements a method given the name and the array of input parameters. |
static String |
plurify(String s,
int howMany,
String language)
Plurifies a given string for a given language. |
static NSArray |
primaryKeyArrayForObject(EOEnterpriseObject obj)
Deprecated. use ERXEOControlUtilities.primaryKeyArrayForObject |
static String |
primaryKeyForObject(EOEnterpriseObject eo)
Deprecated. use ERXEOControlUtilities.primaryKeyStringForObject(EOEnterpriseObject) |
static String |
randomizeDirectActionURL(String daURL)
This method can be used with Direct Action URLs to make sure that the browser will reload the page. |
static Object |
rawPrimaryKeyForObject(EOEnterpriseObject eo)
Returns the raw primary key of the object. |
static Object |
rawPrimaryKeyFromPrimaryKeyAndEO(NSDictionary primaryKey,
EOEnterpriseObject eo)
Deprecated. use just about anything else, like Random.nextInt() for example |
static Object |
readPropertyListFromFileinFramework(String fileName,
String aFrameWorkName)
Reads a file in from the file system and then parses it as if it were a property list. |
static Object |
readPropertyListFromFileInFramework(String fileName,
String aFrameWorkName,
NSArray languageList)
Reads a file in from the file system for the given set of languages and then parses the file as if it were a property list. |
static void |
refreshSharedObjectsWithName(String entityName)
Useful method to refresh all of the shared enterprise objects for a given shared entity. |
static void |
refreshSharedObjectsWithNames(NSArray names)
Refreshes all of the objects for an array of entity names. |
static String |
removeHTMLTagsFromString(String s)
Removes all of the HTML tags from a given string. |
static String |
replaceStringByStringInString(String old,
String newString,
String s)
Deprecated. use {@link ERXStringUtilities#replaceStringByStringInString(String, String, String) |
static String |
resolveUnit(String userInfoUnitString,
EOEnterpriseObject object,
String prefixKeyPath)
Resolves a given user info unit string for a given object. |
static void |
retainEditingContextForCurrentSession(EOEditingContext ec)
Retains an editing context for the current session. |
static boolean |
safeDifferent(Object v1,
Object v2)
A safe different comparison method that first checks to see if either of the objects are null before comparing them with the equals method. |
static boolean |
safeEquals(Object v1,
Object v2)
A safe comparison method that first checks to see if either of the objects are null before comparing them with the equals method. |
static ERXSession |
session()
Returns the current session object for this thread. |
static void |
sessionDidTimeOut(String sessionID)
This method is called when a session times out. |
static void |
setBooleanFlagOnSessionForKey(WOSession s,
String key,
boolean newValue)
Uses the setObjectForKey off of the WOSession
class to push a Boolean object onto the session for a given key.
|
static void |
setDefaultDelegate(EOEditingContext ec)
Deprecated. see ERXEC |
static void |
setDefaultDelegate(EOEditingContext ec,
boolean validation)
Deprecated. see ERXEC |
static void |
setDefaultECNoValidationDelegate(ERXECNoValidationDelegate delegate)
Deprecated. see ERXEC |
static void |
setDefaultEditingContextDelegate(ERXEditingContextDelegate delegate)
Deprecated. see ERXEC |
static void |
setSession(ERXSession session)
Sets the current session for this thread. |
static String |
stringFromFile(File f)
Returns a string from the file using the default encoding. |
static String |
stringFromFile(File f,
String encoding)
Returns a string from the file using the specified encoding. |
static boolean |
stringIsNullOrEmpty(String s)
Deprecated. use {@link ERXStringUtilities#stringIsNullOrEmpty(String) |
static boolean |
stringIsParseableInteger(String s)
Tests if a given string object can be parsed into an integer. |
static String |
stringWithNtimesString(int n,
String s)
Deprecated. use {@link ERXStringUtilities#numberOfOccurrencesOfCharInString(int,String) |
static String |
substituteStringByStringInString(String s1,
String s2,
String s)
|
static String |
userInfoUnit(EOEnterpriseObject object,
String key)
For a given enterprise object and key path, will return what the key 'unit' returns from the userInfo dictionary of the last property of the key path's EOAttribute or EORelationship. |
static String |
userPreferencesKeyFromContext(String key,
NSKeyValueCoding context)
method used by the preferences mechanism from ERDirectToWeb needs to be in here because shared by ERDirectToWeb and ERCoreBusinessLogic The basic idea of this method is to construct a unique key based on a context. |
static String |
userPresentableEOArray(NSArray array,
String attribute)
Deprecated. use ERXArrayUtilities.friendlyDisplayForKeyPath |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static ERXExtensions.Observer observer
public static final String objectsWillChangeInEditingContext
public static ERXLogger adaptorLogger
public static ERXLogger sharedEOadaptorLogger
Constructor Detail |
public ERXExtensions()
Method Detail |
public static Logger log()
public static void configureAdaptorContextRapidTurnAround(Object observer)
observer
- object to register the call back with.public static void configureAdaptorContext()
public static ERXEditingContextDelegate defaultEditingContextDelegate()
ERXEC
public static void setDefaultEditingContextDelegate(ERXEditingContextDelegate delegate)
ERXEC
public static ERXECNoValidationDelegate defaultECNoValidationDelegate()
ERXEC
public static void setDefaultECNoValidationDelegate(ERXECNoValidationDelegate delegate)
ERXEC
public static EOEditingContext newEditingContext()
ERXEC
public static EOEditingContext newEditingContext(boolean validation)
ERXEC
public static EOEditingContext newEditingContext(EOObjectStore objectStore)
ERXEC
public static EOEditingContext newEditingContext(EOObjectStore objectStore, boolean validation)
ERXEC
public static void evaluateSQLWithEntityNamed(String entityName, String exp, EOEditingContext ec)
public static void sessionDidTimeOut(String sessionID)
sessionID
- of the session that timed outpublic static void retainEditingContextForCurrentSession(EOEditingContext ec)
ec
- to be retained.public static void setDefaultDelegate(EOEditingContext ec)
ERXEC
public static void setDefaultDelegate(EOEditingContext ec, boolean validation)
ERXEC
public static EOArrayDataSource dataSourceForArray(NSArray array)
ERXEOControlUtilities.dataSourceForArray(NSArray)
public static NSArray arrayFromDataSource(EODataSource dataSource)
ERXEOControlUtilities#arrayFromDataSource(NSArray)
public static EODetailDataSource dataSourceForObjectAndKey(EOEnterpriseObject eo, String key)
ERXEOControlUtilities#arrayFromDataSource(NSArray)
public static String friendlyEOArrayDisplayForKey(NSArray list, String attribute, String nullArrayDisplay)
public static String replaceStringByStringInString(String old, String newString, String s)
public static String emptyStringForNull(String s)
public static String nullForEmptyString(String s)
public static boolean stringIsNullOrEmpty(String s)
public static int numberOfOccurrencesOfCharInString(char c, String s)
public static String stringWithNtimesString(int n, String s)
public static String removeHTMLTagsFromString(String s)
ERXSimpleHTMLFormatter
s
- html string
public static void forceGC(int maxLoop)
maxLoop
- maximum times to run the garbage
collector. Passing in 0 will cause the
collector to run until all free objects
have been collected.public static boolean isNewObject(EOEnterpriseObject eo)
ERXEOControlUtilities.isNewObject(EOEnterpriseObject)
public static String primaryKeyForObject(EOEnterpriseObject eo)
ERXEOControlUtilities.primaryKeyStringForObject(EOEnterpriseObject)
public static Object rawPrimaryKeyFromPrimaryKeyAndEO(NSDictionary primaryKey, EOEnterpriseObject eo)
public static NSArray primaryKeyArrayForObject(EOEnterpriseObject obj)
ERXEOControlUtilities.primaryKeyArrayForObject instead.
EOUtilities
.
obj
- enterprise object to get the primary key array from.
public static Object rawPrimaryKeyForObject(EOEnterpriseObject eo)
eo
- enterprise object to get the primary key frompublic static String capitalize(String s)
s
- string to capitalize
public static String plurify(String s, int howMany, String language)
ERXLocalizer
for more information.
s
- string to plurifyhowMany
- number of itslanguage
- target language
public static boolean safeEquals(Object v1, Object v2)
equals
method.
v1
- first objectv2
- second object
public static boolean safeDifferent(Object v1, Object v2)
equals
method.
v1
- first objectv2
- second object
public static boolean stringIsParseableInteger(String s)
s
- string to be parsed
public static int intFromParseableIntegerString(String s)
s
- string to be parsed.
public static String substituteStringByStringInString(String s1, String s2, String s)
public static ERXSimpleHTMLFormatter htmlFormatter()
public static void addObjectToBothSidesOfPotentialRelationshipFromObjectWithKeyPath(EOEnterpriseObject to, EOEnterpriseObject from, String keyPath)
to
- enterprise object that is having objects added to itfrom
- enterprise object that is providing the objectskeyPath
- that specifies the relationship on the to object
to add the objects to.public static NSArray flatten(NSArray array)
ERXArrayUtilities.flatten
public static NSDictionary eosInArrayGroupedByKeyPath(NSArray eos, String keyPath)
ERXArrayUtilities.arrayGroupedByKeyPath
public static NSDictionary eosInArrayGroupedByKeyPath(NSArray eos, String keyPath, boolean includeNulls, String extraKeyPathForValues)
ERXArrayUtilities.arrayGroupedByKeyPath
public static boolean arraysAreIdenticalSets(NSArray a1, NSArray a2)
ERXArrayUtilities.arraysAreIdenticalSets(NSArray, NSArray)
public static NSArray filteredArrayWithQualifierEvaluation(NSArray a, EOQualifierEvaluation q)
ERXArrayUtilities.filteredArrayWithQualifierEvaluation
EOQualifierEvaluation
interface.
public static String byteArrayToHexString(byte[] data)
ERXStringUtilities.byteArrayToHexString
instead
data
- array of bytes
public static byte[] hexStringToByteArray(String s)
ERXStringUtilities.hexStringToByteArray instead
s
- string
public static byte[] bytesFromFile(File f) throws IOException
f
- file to get the bytes from
IOException
- if things go wrongpublic static String stringFromFile(File f) throws IOException
f
- file to read
IOException
public static String stringFromFile(File f, String encoding) throws IOException
f
- file to readencoding
- to be used, null will use the default
IOException
public static long lastModifiedDateForFileInFramework(String fileName, String frameworkName)
fileName
- name of the fileframeworkName
- name of the framework, null or "app"
for the application bundle
lastModified
method off of the
file objectpublic static Object readPropertyListFromFileinFramework(String fileName, String aFrameWorkName)
fileName
- name of the fileaFrameWorkName
- name of the framework, null or
'app' for the application bundle.
public static Object readPropertyListFromFileInFramework(String fileName, String aFrameWorkName, NSArray languageList)
fileName
- name of the fileaFrameWorkName
- name of the framework, null or
'app' for the application bundle.languageList
- language list search order
public static String userInfoUnit(EOEnterpriseObject object, String key)
userInfoUnit(aCar, "speed");
userInfoUnit(aDrive, "toCar.speed");
Units can be very useful for adding meta information to particular
attributes and relationships in models. The ERDirectToWeb framework
adds support for displaying units.
object
- to resolve the key-path fromkey
- path off of the object
public static String resolveUnit(String userInfoUnitString, EOEnterpriseObject object, String prefixKeyPath)
userInfoUnit
for
a better description of getting values out of the userInfo
dictionary. This method deals with resolving dynamic userInfo
keys. These keys need to start with the '@@' symbol. For instance
if you have the user info value '@unit' off of an attribute for the
entity Movie, then you can either pass in a Movie object or a
different object with a prefix key path to a movie object.
userInfoUnitString
- string to be resolved, needs to start with
'@@' this keypath will be evaluated against either the object
if no prefixKeyPath is specified or the object returned by
the prefixKeyPath being evaluated against the object passed in.object
- to resolve either the user info unit or the prefixKeyPath.prefixKeyPath
- used as a prefix for the unit resolution.
public static NSArray arrayWithoutDuplicates(NSArray anArray)
ERXArrayUtilities.arrayWithoutDuplicates
public static NSArray arrayWithoutDuplicateKeyValue(NSArray eos, String key)
ERXArrayUtilities.arrayWithoutDuplicateKeyValue
public static NSArray arrayMinusArray(NSArray main, NSArray minus)
ERXArrayUtilities.arrayMinusArray
public static NSArray arrayByAddingObjectsFromArrayWithoutDuplicates(NSArray a1, NSArray a2)
ERXArrayUtilities.arrayByAddingObjectsFromArrayWithoutDuplicates
public static void addObjectsFromArrayWithoutDuplicates(NSMutableArray a1, NSArray a2)
ERXArrayUtilities.addObjectsFromArrayWithoutDuplicates
public static String userPresentableEOArray(NSArray array, String attribute)
ERXArrayUtilities.friendlyDisplayForKeyPath
public static void refreshSharedObjectsWithNames(NSArray names)
names
- array of shared entity namespublic static void refreshSharedObjectsWithName(String entityName)
entityName
- name of the shared entitypublic static String randomizeDirectActionURL(String daURL)
daURL
- a url to add the randomization to.
public static void addRandomizeDirectActionURL(StringBuffer daURL)
daURL
- a url to add the randomization to.public static String addWosidFormValue(String url, WOSession s)
url
- to add wosid form value to.
public static String cleanString(String newString, NSArray toBeCleaneds)
newString
- string to have other strings removed from ittoBeCleaneds
- array of strings to check to see if the other
string contains
public static void setBooleanFlagOnSessionForKey(WOSession s, String key, boolean newValue)
setObjectForKey
off of the WOSession
class to push a Boolean object onto the session for a given key.
Note this is not using key value coding, meaning you don't need
to have a boolean instance variable corresponding to the given
key on your session object. This flag can be retrieved using
the method booleanFlagOnSessionForKeyWithDefault
.
s
- session object to have the boolean flag set onkey
- to be used in the session's dictionarynewValue
- boolean value to be set on the sessionpublic static boolean booleanFlagOnSessionForKeyWithDefault(WOSession s, String key, boolean defaultValue)
booleanValue
off of
ERXUtilities
. If there is not an object corresponding
to the key passed in, then the default value is returned. The
usual way in which boolean values are set on the session object
is by using the method setBooleanFlagOnSessionForKey
in this class.
s
- session object to retrieve the boolean flag fromkey
- that the boolean is stored underdefaultValue
- value to be returned if the object in the
dictionary is null
public static void setSession(ERXSession session)
ERXSession
's awake and sleep methods.
session
- that is currently active for this thread.public static ERXSession session()
public static String userPreferencesKeyFromContext(String key, NSKeyValueCoding context)
key
- preference keycontext
- most likely a d2wContext object
public static void freeProcessResources(Process p)
p
- process to destroypublic static boolean objectImplementsMethod(Object object, String methodName, Class[] parameters)
object
- to determine if it implements a methodmethodName
- name of the methodparameters
- array of parameters
|
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 |