public class ERXEOEncodingUtilities extends Object
Name | Description |
---|---|
er.extensions.ERXEOEncodingUtilities.EntityNameSeparator | er.extensions.ERXEOEncodingUtilities.EntityNameSeparator |
er.extensions.ERXEOEncodingUtilities.SpecifySeparatorInURL | er.extensions.ERXEOEncodingUtilities.SpecifySeparatorInURL |
Modifier and Type | Field and Description |
---|---|
protected static NSMutableDictionary |
_encodedEntityNames
This dictionary contains the encoded entity names used in the defaultGroup
|
static String |
EncodedEntityNameKey
Key used in EOModeler to specify the encoded (or abbreviated) entity
named used when encoding an enterprise-object is an url.
|
Constructor and Description |
---|
ERXEOEncodingUtilities() |
Modifier and Type | Method and Description |
---|---|
static NSArray |
decodeEnterpriseObjectsFromFormValues(com.webobjects.eocontrol.EOEditingContext ec,
NSDictionary values)
Decodes all of the objects for a given set of form values in
the given editing context.
|
static NSDictionary |
dictionaryOfFormValuesForEnterpriseObjects(NSArray eos,
String separator,
boolean encrypt)
Constructs the form values dictionary by first calling
the method
encodeEnterpriseObjectsPrimaryKeyForUrl
and then using the results of that to construct the dictionary. |
protected static NSDictionary |
encodedEntityNames()
This method constructs a dictionary with encoded
entity names as keys and entity names as values.
|
static String |
encodeEnterpriseObjectPrimaryKeyForUrl(com.webobjects.eocontrol.EOEnterpriseObject eo,
String seperator,
boolean encrypt)
Simple cover method that calls the method:
encodeEnterpriseObjectsPrimaryKeyForUrl with
an array containing the single object passed in. |
static String |
encodeEnterpriseObjectsPrimaryKeyForUrl(NSArray eos,
String separator,
boolean encrypt)
Encodes an array of enterprise objects for use in a url.
|
static com.webobjects.eocontrol.EOEnterpriseObject |
enterpriseObjectForEntityNamedFromFormValues(com.webobjects.eocontrol.EOEditingContext ec,
String entityName,
NSDictionary formValues)
Returns the enterprise object fetched with decoded
formValues from
entityName . |
static NSArray |
enterpriseObjectsForEntityNamedFromFormValues(com.webobjects.eocontrol.EOEditingContext ec,
String entityName,
NSDictionary formValues)
Returns the enterprise objects fetched with decoded
formValues from
entityName . |
static String |
entityNameDecode(String encodedName)
Decodes the encoded entity name.
|
static String |
entityNameEncode(com.webobjects.eocontrol.EOEnterpriseObject eo)
This method encodes the entity name of the enterprise object
by searching in the default model group whether it can find
the key EncodedEntityNameKey in the user info dictionary.
|
static String |
entityNameSeparator() |
static NSDictionary |
groupedEnterpriseObjectsFromFormValues(com.webobjects.eocontrol.EOEditingContext ec,
NSDictionary formValues)
Returns enterprise objects grouped by entity name.
|
static void |
init()
Class initialization
|
static boolean |
isSpecifySeparatorInURL() |
static void |
setEntityNameSeparator(String entityNameSeparator) |
static void |
setSpecifySeparatorInURL(boolean specifySeparatorInURL) |
public static final String EncodedEntityNameKey
protected static NSMutableDictionary _encodedEntityNames
public static void init()
public static void setSpecifySeparatorInURL(boolean specifySeparatorInURL)
public static boolean isSpecifySeparatorInURL()
public static void setEntityNameSeparator(String entityNameSeparator)
public static String entityNameSeparator()
public static NSDictionary groupedEnterpriseObjectsFromFormValues(com.webobjects.eocontrol.EOEditingContext ec, NSDictionary formValues)
encodeEnterpriseObjectsPrimaryKeyForUrl
.ec
- the editing context to fetch the objects fromformValues
- dictionary where the values are an
encoded representation of the primary key values in either
cleartext or encrypted format.public static com.webobjects.eocontrol.EOEnterpriseObject enterpriseObjectForEntityNamedFromFormValues(com.webobjects.eocontrol.EOEditingContext ec, String entityName, NSDictionary formValues)
formValues
from
entityName
.ec
- the editing context to fetch the object fromentityName
- the entity to fetch the object fromformValues
- dictionary where the values are an
encoded representation of the primary key values in either
cleartext or encrypted format.public static NSArray enterpriseObjectsForEntityNamedFromFormValues(com.webobjects.eocontrol.EOEditingContext ec, String entityName, NSDictionary formValues)
formValues
from
entityName
.ec
- the editing context to fetch the objects fromentityName
- the entity to fetch the objects fromformValues
- dictionary where the values are an
encoded representation of the primary key values in either
cleartext or encrypted format.public static String entityNameEncode(com.webobjects.eocontrol.EOEnterpriseObject eo)
eo
- the enterprise objectprotected static final NSDictionary encodedEntityNames()
public static String entityNameDecode(String encodedName)
encodedName
- the encode name.public static NSDictionary dictionaryOfFormValuesForEnterpriseObjects(NSArray eos, String separator, boolean encrypt)
encodeEnterpriseObjectsPrimaryKeyForUrl
and then using the results of that to construct the dictionary.eos
- array of enterprise objects to be encoded in the urlseparator
- to be used to separate entity namesencrypt
- flag to determine if the primary key
of the objects should be encrypted.public static String encodeEnterpriseObjectPrimaryKeyForUrl(com.webobjects.eocontrol.EOEnterpriseObject eo, String seperator, boolean encrypt)
encodeEnterpriseObjectsPrimaryKeyForUrl
with
an array containing the single object passed in.eo
- enterprise object to encode in a url.seperator
- to be used for the entity name.encrypt
- flag to determine if the primary key
of the object should be encrypted.public static String encodeEnterpriseObjectsPrimaryKeyForUrl(NSArray eos, String separator, boolean encrypt)
For example imagine that an array containing two User objects(pk 13 and 24) and one Company object(pk 56) are passed to this method, null is passed in for the separator which means the default seperator will be used which is '_' and false is passed for encryption. Then the url that would be generated would be: sep=_&User_1=13&User_2=24&Company_3=56
If on the other hand let's say you use the _ character in entity names and you want the primary keys encrypted then passing in the same array up above but with "##" specified as the separator and true for the encrypt boolean would yield: sep=##&User##E1=SOMEGARBAGE8723&User##E2=SOMEGARBAGE23W&Company##E3=SOMEGARBAGE8723
Note that in the above encoding the seperator is always passed and the upper case
E specifies if the corresponding value should be decrypted.
Compound primary keys are supported, giving the following url:
sep=_&EntityName_1=1.1&EntityName_2=1.2
where 1.1
and 1.2
are the primary key values. Key values
follow alphabetical order for their attribute names, just like
ERXEOControlUtilities.primaryKeyArrayForObject
.
Note: At the moment the attribute value separator cannot be changed.
eos
- array of enterprise objects to be encoded in the urlseparator
- to be used between the entity name and a sequence numberencrypt
- indicates if the primary keys of the objects should be encryptedpublic static NSArray decodeEnterpriseObjectsFromFormValues(com.webobjects.eocontrol.EOEditingContext ec, NSDictionary values)
encodeEnterpriseObjectsPrimaryKeyForUrl
.ec
- editingcontext to fetch the objects fromvalues
- form value dictionary where the values are an
encoded representation of the primary key values in either
cleartext or encrypted format.Copyright © 2002 – 2020 Project Wonder.