|
|||||||||
| Home >> All >> er >> [ extensions overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
er.extensions
Class ERXExtensions

java.lang.Objecter.extensions.ERXExtensions
- public class ERXExtensions
- extends java.lang.Object
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 | |
private static ERXECNoValidationDelegate |
_defaultECNoValidationDelegate
holds references to default editing context delegate without validation |
private static ERXEditingContextDelegate |
_defaultEditingContextDelegate
holds references to default editing context delegate |
private static NSMutableDictionary |
_editingContextsPerSession
Retaining the editing contexts explicitly until the session that was active when they were created goes away this hopefully will go some way towards avoiding the 'attempted to send message to EO whose EditingContext is gone. |
private static boolean |
_isConfigureAdaptorContextRapidTurnAround
flag to inidicate if rapid turn around is enabled for the adaptor channel logging. |
private static boolean |
_isInitialized
We only ever want the framework to be init's once. |
private static org.apache.log4j.Logger |
_log
logging support |
private static java.util.Random |
_random
Holds a reference to the random object |
private static java.lang.Boolean |
adaptorEnabled
flag to indicate if adaptor channel logging is enabled |
static ERXLogger |
adaptorLogger
logging support for the adaptor channel |
private static char[] |
hex
holds the array of hex values |
static java.lang.String |
objectsWillChangeInEditingContext
|
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 55 |
static void |
addObjectToBothSidesOfPotentialRelationshipFromObjectWithKeyPath(EOEnterpriseObject to,
EOEnterpriseObject from,
java.lang.String keyPath)
This method handles 3 different cases 1. |
static void |
addRandomizeDirectActionURL(java.lang.StringBuffer daURL)
This method can be used with Direct Action URLs to make sure that the browser will reload the page. |
static java.lang.String |
addWosidFormValue(java.lang.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 55 |
static NSArray |
arrayFromDataSource(EODataSource dataSource)
|
static NSArray |
arrayMinusArray(NSArray main,
NSArray minus)
Deprecated. use ERXArrayUtilities.arrayMinusArray 55 |
static boolean |
arraysAreIdenticalSets(NSArray a1,
NSArray a2)
Deprecated. use ERXArrayUtilities.arraysAreIdenticalSets(NSArray, NSArray) 55 |
static NSArray |
arrayWithoutDuplicateKeyValue(NSArray eos,
java.lang.String key)
Deprecated. use ERXArrayUtilities.arrayWithoutDuplicateKeyValue 55 |
static NSArray |
arrayWithoutDuplicates(NSArray anArray)
Deprecated. use ERXArrayUtilities.arrayWithoutDuplicates 55 |
static boolean |
booleanFlagOnSessionForKeyWithDefault(WOSession s,
java.lang.String key,
boolean defaultValue)
Retrieves a value from the session's dictionary and evaulates that object using the method booleanValue off of
ERXUtilities. |
static java.lang.String |
byteArrayToHexString(byte[] data)
Converts an array of bytes to a hex string |
static byte[] |
bytesFromFile(java.io.File f)
Returns the byte array for a given file. |
static java.lang.String |
capitalize(java.lang.String s)
Capitalizes the given string. |
static java.lang.String |
cleanString(java.lang.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(java.lang.Object observer)
Configures the passed in observer to register a call back when the configuration file is changed. |
static EOArrayDataSource |
dataSourceForArray(NSArray array)
|
static EODetailDataSource |
dataSourceForObjectAndKey(EOEnterpriseObject object,
java.lang.String key)
Creates a detail data source for a given enterprise object and a relationship key. |
static ERXECNoValidationDelegate |
defaultECNoValidationDelegate()
Default delegate that does not perform validation. |
static ERXEditingContextDelegate |
defaultEditingContextDelegate()
Returns the default editing context delegate. |
static java.lang.String |
emptyStringForNull(java.lang.Object o)
Simple utility method that will return the string "" if the object passed in is null otherwise it will return the passed in object with toString called on it. |
static java.lang.String |
emptyStringForNull(java.lang.String s)
Simple utility method that will return the string "" if the string passed in is null otherwise it will return the passed in string. |
static NSDictionary |
eosInArrayGroupedByKeyPath(NSArray eos,
java.lang.String keyPath)
Deprecated. use ERXArrayUtilities.arrayGroupedByKeyPath 55 |
static NSDictionary |
eosInArrayGroupedByKeyPath(NSArray eos,
java.lang.String keyPath,
boolean includeNulls,
java.lang.String extraKeyPathForValues)
Deprecated. use ERXArrayUtilities.arrayGroupedByKeyPath 55 |
static void |
evaluateSQLWithEntityNamed(java.lang.String entityName,
java.lang.String exp,
EOEditingContext ec)
Utility method used to execute arbitrary SQL. |
static NSArray |
filteredArrayWithQualifierEvaluation(NSArray a,
EOQualifierEvaluation q)
Deprecated. use ERXArrayUtilities.filteredArrayWithQualifierEvaluation 55 |
static NSArray |
flatten(NSArray array)
Deprecated. use ERXArrayUtilities.flatten 55 instead. |
static void |
forceGC(int maxLoop)
Forces the garbage collector to run. |
static void |
freeProcessResources(java.lang.Process p)
Frees all of a resources associated with a given process and then destroys it. |
static java.lang.String |
friendlyEOArrayDisplayForKey(NSArray list,
java.lang.String attribute,
java.lang.String nullArrayDisplay)
Deprecated. use {@link ERXArrayUtilities#friendlyDisplayForKeyPath(NSArray, String, String, String, String) |
static byte[] |
hexStringToByteArray(java.lang.String s)
Converts a hex string into an array of bytes |
static ERXSimpleHTMLFormatter |
htmlFormatter()
|
static int |
intFromParseableIntegerString(java.lang.String s)
Returns an integer from a parsable string. |
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 long |
lastModifiedDateForFileInFramework(java.lang.String fileName,
java.lang.String frameworkName)
Determines the last modification date for a given file in a framework. |
static org.apache.log4j.Logger |
log()
creates and caches the logging logger |
static EOEditingContext |
newEditingContext()
Factory method to create a new editing context. |
static EOEditingContext |
newEditingContext(boolean validation)
Factory method to create a new editing context with validation disabled. |
static EOEditingContext |
newEditingContext(EOObjectStore objectStore,
boolean validation)
Creates a new editing context with the specified object store as the parent object store and with validation turned on or off depending on the flag passed in. |
static java.lang.String |
nullForEmptyString(java.lang.Object o)
Simple utility method that will return null if the toString method off of
the object is equal to "" otherwise it will
return the passed in object with toString
called on it. |
static java.lang.String |
nullForEmptyString(java.lang.String s)
Simple utility method that will return null if the string passed in is equal to "" otherwise it will return the passed in string. |
static int |
numberOfOccurrencesOfCharInString(char c,
java.lang.String s)
Counts the number fo occurrences of a particular char in a given string. |
static boolean |
objectImplementsMethod(java.lang.Object object,
java.lang.String methodName,
java.lang.Class[] parameters)
Determines if a given object implements a method given the name and the array of input parameters. |
static java.lang.String |
plurify(java.lang.String s,
int howMany,
java.lang.String language)
Plurifies a given string for a given language. |
static NSArray |
primaryKeyArrayForObject(EOEnterpriseObject obj)
Gives the primary key array for a given enterprise object. |
static java.lang.String |
primaryKeyForObject(EOEnterpriseObject eo)
Returns the string representation of the primary key for a given object. |
static java.lang.String |
randomizeDirectActionURL(java.lang.String daURL)
This method can be used with Direct Action URLs to make sure that the browser will reload the page. |
static java.lang.Object |
rawPrimaryKeyForObject(EOEnterpriseObject eo)
Returns the raw primary key of the object. |
static java.lang.Object |
rawPrimaryKeyFromPrimaryKeyAndEO(NSDictionary primaryKey,
EOEnterpriseObject eo)
|
static java.lang.Object |
readPropertyListFromFileinFramework(java.lang.String fileName,
java.lang.String aFrameWorkName)
Reads a file in from the file system and then parses it as if it were a property list. |
static java.lang.Object |
readPropertyListFromFileInFramework(java.lang.String fileName,
java.lang.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(java.lang.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 java.lang.String |
removeHTMLTagsFromString(java.lang.String s)
Removes all of the HTML tags from a given string. |
static java.lang.String |
replaceStringByStringInString(java.lang.String old,
java.lang.String newString,
java.lang.String s)
Replaces a given string by another string in a string. |
static java.lang.String |
resolveUnit(java.lang.String userInfoUnitString,
EOEnterpriseObject object,
java.lang.String prefixKeyPath)
Resolves a given user info unit string for a given object. |
static boolean |
safeDifferent(java.lang.Object v1,
java.lang.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.Note that if both objects are null then they will be considered equal. |
static boolean |
safeEquals(java.lang.Object v1,
java.lang.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.Note that if both objects are null then they will be considered equal. |
static ERXSession |
session()
Returns the current session object for this thread. |
static void |
sessionDidTimeOut(java.lang.String sessionID)
This method is called when a session times out. |
static void |
setBooleanFlagOnSessionForKey(WOSession s,
java.lang.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)
Sets the default editing context delegate on the given editing context. |
static void |
setDefaultDelegate(EOEditingContext ec,
boolean validation)
Sets either the default editing context delegate that does or does not allow validation based on the validation flag passed in on the given editing context. |
static void |
setDefaultECNoValidationDelegate(ERXECNoValidationDelegate delegate)
Sets the default editing context delegate to be used for editing context creation that does not allow validation. |
static void |
setDefaultEditingContextDelegate(ERXEditingContextDelegate delegate)
Sets the default editing context delegate to be used for editing context creation. |
static void |
setSession(ERXSession session)
Sets the current session for this thread. |
static java.lang.String |
stringFromFile(java.io.File f)
Returns a string from the file using the default encoding. |
static java.lang.String |
stringFromFile(java.io.File f,
java.lang.String encoding)
Returns a string from the file using the specified encoding. |
static boolean |
stringIsNullOrEmpty(java.lang.String s)
Simple test if the string is either null or equal to "". |
static boolean |
stringIsParseableInteger(java.lang.String s)
Tests if a given string object can be parsed into an integer. |
static java.lang.String |
stringWithNtimesString(int n,
java.lang.String s)
String multiplication. |
static java.lang.String |
substituteStringByStringInString(java.lang.String s1,
java.lang.String s2,
java.lang.String s)
|
static java.lang.String |
userInfoUnit(EOEnterpriseObject object,
java.lang.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 java.lang.String |
userPreferencesKeyFromContext(java.lang.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 java.lang.String |
userPresentableEOArray(NSArray array,
java.lang.String attribute)
Deprecated. use {@link ERXArrayUtilities#friendlyDisplayForKeyPath(NSArray, String, String, String, String) |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
_log
private static org.apache.log4j.Logger _log
- logging support
_defaultEditingContextDelegate
private static ERXEditingContextDelegate _defaultEditingContextDelegate
- holds references to default editing context delegate
_defaultECNoValidationDelegate
private static ERXECNoValidationDelegate _defaultECNoValidationDelegate
- holds references to default editing context delegate without validation
_isInitialized
private static boolean _isInitialized
- We only ever want the framework to be init's once.
adaptorLogger
public static ERXLogger adaptorLogger
- logging support for the adaptor channel
sharedEOadaptorLogger
public static ERXLogger sharedEOadaptorLogger
- logging support for shared object loading
adaptorEnabled
private static java.lang.Boolean adaptorEnabled
- flag to indicate if adaptor channel logging is enabled
_isConfigureAdaptorContextRapidTurnAround
private static boolean _isConfigureAdaptorContextRapidTurnAround
- flag to inidicate if rapid turn around is enabled for the
adaptor channel logging.
objectsWillChangeInEditingContext
public static final java.lang.String objectsWillChangeInEditingContext
- See Also:
- Constant Field Values
_editingContextsPerSession
private static NSMutableDictionary _editingContextsPerSession
- Retaining the editing contexts explicitly until the session that was active
when they were created goes away
this hopefully will go some way towards avoiding the 'attempted to send
message to EO whose EditingContext is gone.
hex
private static final char[] hex
- holds the array of hex values
_random
private static java.util.Random _random
- Holds a reference to the random object
| Constructor Detail |
ERXExtensions
public ERXExtensions()
| Method Detail |
log
public static org.apache.log4j.Logger log()
- creates and caches the logging logger
configureAdaptorContextRapidTurnAround
public static void configureAdaptorContextRapidTurnAround(java.lang.Object observer)
- Configures the passed in observer to register a call back
when the configuration file is changed. This allows one to
change a logger's setting and have that changed value change
the NSLog setting to log the generated SQL. This method is
called as part of the framework initialization process.
configureAdaptorContext
public static void configureAdaptorContext()
- This method is called by the delegate when the configuration
file is changed. It's sole purpose is to map a logging logger
to a debug group. Hopefully in the future we will have a more
generic solution.
defaultEditingContextDelegate
public static ERXEditingContextDelegate defaultEditingContextDelegate()
- Returns the default editing context delegate.
This delegate is used by default for all editing
contexts that are created.
setDefaultEditingContextDelegate
public static void setDefaultEditingContextDelegate(ERXEditingContextDelegate delegate)
- Sets the default editing context delegate to be
used for editing context creation.
defaultECNoValidationDelegate
public static ERXECNoValidationDelegate defaultECNoValidationDelegate()
- Default delegate that does not perform validation.
Not performing validation can be a good thing when
using nested editing contexts as sometimes you only
want to validation one object, not all the objects.
setDefaultECNoValidationDelegate
public static void setDefaultECNoValidationDelegate(ERXECNoValidationDelegate delegate)
- Sets the default editing context delegate to be
used for editing context creation that does not
allow validation.
newEditingContext
public static EOEditingContext newEditingContext()
- Factory method to create a new editing context. Sets
the current default delegate on the newly created
editing context.
newEditingContext
public static EOEditingContext newEditingContext(boolean validation)
- Factory method to create a new editing context with
validation disabled. Sets the default no validation
delegate on the editing context. Becareful an
editing context that does not perform validation
means that none of the usual validation methods are
called on the enterprise objects before they are saved
to the database.
evaluateSQLWithEntityNamed
public static void evaluateSQLWithEntityNamed(java.lang.String entityName, java.lang.String exp, EOEditingContext ec)
- Utility method used to execute arbitrary SQL. This
has the advantage over the
EOUtilities
rawRowsForSQLin that it can be used with other statements besides just SELECT without throwing exceptions.
newEditingContext
public static EOEditingContext newEditingContext(EOObjectStore objectStore,
boolean validation)
- Creates a new editing context with the specified object
store as the parent object store and with validation turned
on or off depending on the flag passed in. This method is useful
when creating nested editing contexts. After creating
the editing context the default delegate is set on the
editing context if validation is enabled or the default no
validation delegate is set if validation is disabled.
Note: anEOEditingContextis a subclass of EOObjectStore so passing in another editing context to this method is completely kosher.
sessionDidTimeOut
public static void sessionDidTimeOut(java.lang.String sessionID)
- This method is called when a session times out.
Calling this method will release references to
all editing contexts that were created when this
session was active.
setDefaultDelegate
public static void setDefaultDelegate(EOEditingContext ec)
- Sets the default editing context delegate on
the given editing context.
setDefaultDelegate
public static void setDefaultDelegate(EOEditingContext ec,
boolean validation)
- Sets either the default editing context delegate
that does or does not allow validation based on
the validation flag passed in on the given editing context.
dataSourceForArray
public static EOArrayDataSource dataSourceForArray(NSArray array)
arrayFromDataSource
public static NSArray arrayFromDataSource(EODataSource dataSource)
dataSourceForObjectAndKey
public static EODetailDataSource dataSourceForObjectAndKey(EOEnterpriseObject object,
java.lang.String key)
- Creates a detail data source for a given enterprise
object and a relationship key. These types of datasources
can be very handy when you are displaying a list of objects
a la D2W style and then some objects are added or removed
from the relationship. If an array datasource were used
then the list would not reflect the changes made, however
the detail data source will reflect changes made to the
relationship.
Note: the relationship key does not have to be an eo relationship, instead it just has to return an array of enterprise objects.
friendlyEOArrayDisplayForKey
public static java.lang.String friendlyEOArrayDisplayForKey(NSArray list, java.lang.String attribute, java.lang.String nullArrayDisplay)
- Deprecated. use {@link ERXArrayUtilities#friendlyDisplayForKeyPath(NSArray, String, String, String, String)
replaceStringByStringInString
public static java.lang.String replaceStringByStringInString(java.lang.String old, java.lang.String newString, java.lang.String s)
- Replaces a given string by another string in a string.
This method is just a cover method for calling the
same method in ERXSimpleHTMLFormatter.
emptyStringForNull
public static java.lang.String emptyStringForNull(java.lang.String s)
- Simple utility method that will return the
string "" if the string passed in is null
otherwise it will return the passed in
string.
emptyStringForNull
public static java.lang.String emptyStringForNull(java.lang.Object o)
- Simple utility method that will return the
string "" if the object passed in is null
otherwise it will return the passed in
object with toString called on it.
nullForEmptyString
public static java.lang.String nullForEmptyString(java.lang.String s)
- Simple utility method that will return null
if the string passed in is equal to ""
otherwise it will return the passed in
string.
nullForEmptyString
public static java.lang.String nullForEmptyString(java.lang.Object o)
- Simple utility method that will return null
if the
toStringmethod off of the object is equal to "" otherwise it will return the passed in object with toString called on it.
stringIsNullOrEmpty
public static boolean stringIsNullOrEmpty(java.lang.String s)
- Simple test if the string is either null or
equal to "".
numberOfOccurrencesOfCharInString
public static int numberOfOccurrencesOfCharInString(char c,
java.lang.String s)
- Counts the number fo occurrences of a particular
charin a given string.
stringWithNtimesString
public static java.lang.String stringWithNtimesString(int n, java.lang.String s)
- String multiplication.
removeHTMLTagsFromString
public static java.lang.String removeHTMLTagsFromString(java.lang.String s)
- Removes all of the HTML tags from a given string.
Note: that this is a very simplistic implementation
and will most likely not work with complex HTML.
Note: for actual conversion of HTML tags into regular
strings have a look at ERXSimpleHTMLFormatter
forceGC
public static void forceGC(int maxLoop)
- Forces the garbage collector to run. The
max loop parameter determines the maximum
number of times to run the garbage collector
if the memory footprint is still going down.
In normal cases you would just need to call
this method with the parameter 1. If called
with the parameter 0 the garbage collector
will continue to run until no more free memory
is available to collect.
Note: This can be a very costly operation and should only be used in extreme circumstances.
isNewObject
public 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.
primaryKeyForObject
public static java.lang.String primaryKeyForObject(EOEnterpriseObject eo)
- Returns the string representation of the primary key for
a given object. Note that the object should only have
one primary key.
rawPrimaryKeyFromPrimaryKeyAndEO
public static java.lang.Object rawPrimaryKeyFromPrimaryKeyAndEO(NSDictionary primaryKey, EOEnterpriseObject eo)
primaryKeyArrayForObject
public static NSArray primaryKeyArrayForObject(EOEnterpriseObject obj)
- Gives the primary key array for a given enterprise
object. This has the advantage of not firing the
fault of the object, unlike the method in
EOUtilities.
rawPrimaryKeyForObject
public static java.lang.Object rawPrimaryKeyForObject(EOEnterpriseObject eo)
- Returns the raw primary key of the object. Possible
objects returned could be Integer, BigDecimal or NSData.
Note: the object passed in should only have one primary
key.
capitalize
public static java.lang.String capitalize(java.lang.String s)
- Capitalizes the given string.
plurify
public static java.lang.String plurify(java.lang.String s, int howMany, java.lang.String language)
- Plurifies a given string for a given language.
See ERXLocalizer for more information.
safeEquals
public static boolean safeEquals(java.lang.Object v1, java.lang.Object v2)
- A safe comparison method that first checks to see
if either of the objects are null before comparing
them with the
equalsmethod.
Note that if both objects are null then they will be considered equal.
safeDifferent
public static boolean safeDifferent(java.lang.Object v1, java.lang.Object v2)
- A safe different comparison method that first checks to see
if either of the objects are null before comparing
them with the
equalsmethod.
Note that if both objects are null then they will be considered equal.
stringIsParseableInteger
public static boolean stringIsParseableInteger(java.lang.String s)
- Tests if a given string object can be parsed into
an integer.
intFromParseableIntegerString
public static int intFromParseableIntegerString(java.lang.String s)
- Returns an integer from a parsable string. If the
string can not be parsed then 0 is returned.
substituteStringByStringInString
public static java.lang.String substituteStringByStringInString(java.lang.String s1, java.lang.String s2, java.lang.String s)
htmlFormatter
public static ERXSimpleHTMLFormatter htmlFormatter()
addObjectToBothSidesOfPotentialRelationshipFromObjectWithKeyPath
public static void addObjectToBothSidesOfPotentialRelationshipFromObjectWithKeyPath(EOEnterpriseObject to,
EOEnterpriseObject from,
java.lang.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.
flatten
public static NSArray flatten(NSArray array)
- Deprecated. use ERXArrayUtilities.flatten 55 instead.
- Recursively flattens an array of arrays into a single array of elements.
- Recursively flattens an array of arrays into a single array of elements.
eosInArrayGroupedByKeyPath
public static NSDictionary eosInArrayGroupedByKeyPath(NSArray eos,
java.lang.String keyPath)
- Deprecated. use ERXArrayUtilities.arrayGroupedByKeyPath 55
- Groups an array of objects by a given key path.
- Groups an array of objects by a given key path.
eosInArrayGroupedByKeyPath
public static NSDictionary eosInArrayGroupedByKeyPath(NSArray eos,
java.lang.String keyPath,
boolean includeNulls,
java.lang.String extraKeyPathForValues)
- Deprecated. use ERXArrayUtilities.arrayGroupedByKeyPath 55
- Groups an array of objects by a given key path.
- Groups an array of objects by a given key path.
arraysAreIdenticalSets
public static boolean arraysAreIdenticalSets(NSArray a1,
NSArray a2)
- Deprecated. use
ERXArrayUtilities.arraysAreIdenticalSets(NSArray, NSArray)55- Simple comparision method to see if two array objects are identical sets.
- Simple comparision method to see if two array objects are identical sets.
filteredArrayWithQualifierEvaluation
public static NSArray filteredArrayWithQualifierEvaluation(NSArray a,
EOQualifierEvaluation q)
- Deprecated. use ERXArrayUtilities.filteredArrayWithQualifierEvaluation 55
- Filters an array using the
EOQualifierEvaluationinterface. - Filters an array using the
byteArrayToHexString
public static java.lang.String byteArrayToHexString(byte[] data)
- Converts an array of bytes to a hex string
hexStringToByteArray
public static byte[] hexStringToByteArray(java.lang.String s)
- Converts a hex string into an array of bytes
bytesFromFile
public static byte[] bytesFromFile(java.io.File f) throws java.io.IOException
- Returns the byte array for a given file.
stringFromFile
public static java.lang.String stringFromFile(java.io.File f) throws java.io.IOException
- Returns a string from the file using the default
encoding.
stringFromFile
public static java.lang.String stringFromFile(java.io.File f, java.lang.String encoding) throws java.io.IOException
- Returns a string from the file using the specified
encoding.
lastModifiedDateForFileInFramework
public static long lastModifiedDateForFileInFramework(java.lang.String fileName, java.lang.String frameworkName)
- Determines the last modification date for a given file
in a framework. Note that this method will only test for
the global resource not the localized resources.
readPropertyListFromFileinFramework
public static java.lang.Object readPropertyListFromFileinFramework(java.lang.String fileName, java.lang.String aFrameWorkName)
- Reads a file in from the file system and then parses
it as if it were a property list.
readPropertyListFromFileInFramework
public static java.lang.Object readPropertyListFromFileInFramework(java.lang.String fileName, java.lang.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.
userInfoUnit
public static java.lang.String userInfoUnit(EOEnterpriseObject object, java.lang.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.
The userInfo dictionary can be edited via EOModeler, it is that
open book looking icon when looking at either an attribute or
relationship.
For example if the userInfo dictionary or the attribute 'speed' on the entity Car contained the key-value pair unit=mph, then this method would be able to resolve that unit given either of these keypaths:
userInfoUnit(aCar, "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.
userInfoUnit(aDrive, "toCar.speed");
resolveUnit
public static java.lang.String resolveUnit(java.lang.String userInfoUnitString, EOEnterpriseObject object, java.lang.String prefixKeyPath)
- Resolves a given user info unit string for a given object.
User info values are stored in an EOAttibute or EORelationship's
userInfo dictionary. See the method
userInfoUnitfor 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.
arrayWithoutDuplicates
public static NSArray arrayWithoutDuplicates(NSArray anArray)
- Deprecated. use ERXArrayUtilities.arrayWithoutDuplicates 55
- Filters out all of the duplicate objects in a given array.
- Filters out all of the duplicate objects in a given array.
arrayWithoutDuplicateKeyValue
public static NSArray arrayWithoutDuplicateKeyValue(NSArray eos,
java.lang.String key)
- Deprecated. use ERXArrayUtilities.arrayWithoutDuplicateKeyValue 55
- Filters out duplicates of an array of enterprise objects based on the value of the given key off of those objects.
- Filters out duplicates of an array of enterprise objects based on the value of the given key off of those objects.
arrayMinusArray
public static NSArray arrayMinusArray(NSArray main,
NSArray minus)
- Deprecated. use ERXArrayUtilities.arrayMinusArray 55
- Subtracts the contents of one array from another.
- Subtracts the contents of one array from another.
arrayByAddingObjectsFromArrayWithoutDuplicates
public static NSArray arrayByAddingObjectsFromArrayWithoutDuplicates(NSArray a1,
NSArray a2)
- Deprecated. use ERXArrayUtilities.arrayByAddingObjectsFromArrayWithoutDuplicates 55
- Creates an array preserving order by adding all of the non-duplicate values from the second array to the first.
- Creates an array preserving order by adding all of the non-duplicate values from the second array to the first.
addObjectsFromArrayWithoutDuplicates
public static void addObjectsFromArrayWithoutDuplicates(NSMutableArray a1,
NSArray a2)
- Deprecated. use ERXArrayUtilities.addObjectsFromArrayWithoutDuplicates 55
- Adds all of the non-duplicate elements from the second array to the mutable array.
- Adds all of the non-duplicate elements from the second array to the mutable array.
userPresentableEOArray
public static java.lang.String userPresentableEOArray(NSArray array, java.lang.String attribute)
- Deprecated. use {@link ERXArrayUtilities#friendlyDisplayForKeyPath(NSArray, String, String, String, String)
refreshSharedObjectsWithNames
public static void refreshSharedObjectsWithNames(NSArray names)
- Refreshes all of the objects for an array of entity names.
refreshSharedObjectsWithName
public static void refreshSharedObjectsWithName(java.lang.String entityName)
- Useful method to refresh all of the shared enterprise objects
for a given shared entity. The current implementation depends
on the shared entity to have a fetch specification named 'FetchAll'
which will be created for you if you check the box that says
'share all objects'.
randomizeDirectActionURL
public static java.lang.String randomizeDirectActionURL(java.lang.String daURL)
- This method can be used with Direct Action URLs to make sure
that the browser will reload the page. This is done by
adding the parameter [? | &]r=random_number to the end of the
url.
addRandomizeDirectActionURL
public static void addRandomizeDirectActionURL(java.lang.StringBuffer daURL)
- This method can be used with Direct Action URLs to make sure
that the browser will reload the page. This is done by
adding the parameter [? | &]r=random_number to the end of the
url.
addWosidFormValue
public static java.lang.String addWosidFormValue(java.lang.String url, WOSession s)
- Adds the wosid for a given session to a given url.
cleanString
public static java.lang.String cleanString(java.lang.String newString, NSArray toBeCleaneds)
- Removes any occurances of any strings in the array passed
in from the string passed in. Used in conjunction with
fuzzy matching.
setBooleanFlagOnSessionForKey
public static void setBooleanFlagOnSessionForKey(WOSession s,
java.lang.String key,
boolean newValue)
- Uses the
setObjectForKeyoff of theWOSessionclass 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 methodbooleanFlagOnSessionForKeyWithDefault.
booleanFlagOnSessionForKeyWithDefault
public static boolean booleanFlagOnSessionForKeyWithDefault(WOSession s,
java.lang.String key,
boolean defaultValue)
- Retrieves a value from the session's dictionary and evaulates
that object using the method
booleanValueoff 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 methodsetBooleanFlagOnSessionForKeyin this class.
setSession
public static void setSession(ERXSession session)
- Sets the current session for this thread. This is called
from ERXSession's awake and sleep methods.
session
public static ERXSession session()
- Returns the current session object for this thread.
userPreferencesKeyFromContext
public static java.lang.String userPreferencesKeyFromContext(java.lang.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.
freeProcessResources
public static void freeProcessResources(java.lang.Process p)
- Frees all of a resources associated with a given
process and then destroys it.
objectImplementsMethod
public static boolean objectImplementsMethod(java.lang.Object object, java.lang.String methodName, java.lang.Class[] parameters)
- Determines if a given object implements a method given
the name and the array of input parameters.
|
|||||||||
| Home >> All >> er >> [ extensions overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
er.extensions.ERXExtensions