ERXEOEncodingUtilities Class Reference
List of all members.
|
Static Public Member Functions |
| static NSArray | decodeEnterpriseObjectsFromFormValues (EOEditingContext ec, NSDictionary values) |
| static NSDictionary | dictionaryOfFormValuesForEnterpriseObjects (NSArray eos, String separator, boolean encrypt) |
| static String | encodeEnterpriseObjectPrimaryKeyForUrl (EOEnterpriseObject eo, String seperator, boolean encrypt) |
| static String | encodeEnterpriseObjectsPrimaryKeyForUrl (NSArray eos, String separator, boolean encrypt) |
| static EOEnterpriseObject | enterpriseObjectForEntityNamedFromFormValues (EOEditingContext ec, String entityName, NSDictionary formValues) |
| static NSArray | enterpriseObjectsForEntityNamedFromFormValues (EOEditingContext ec, String entityName, NSDictionary formValues) |
| static NSArray | enterpriseObjectsFromFormValues (EOEditingContext ec, NSDictionary formValues) |
| static String | entityNameDecode (String encodedName) |
| static String | entityNameEncode (EOEnterpriseObject eo) |
| static String | entityNameSeparator () |
| static NSDictionary | groupedEnterpriseObjectsFromFormValues (EOEditingContext ec, NSDictionary formValues) |
| static synchronized void | init () |
| static boolean | isSpecifySeparatorInURL () |
| static void | setEntityNameSeparator (String entityNameSeparator) |
| static void | setSpecifySeparatorInURL (boolean specifySeparatorInURL) |
Static Public Attributes |
| static final String | EncodedEntityNameKey = "EncodedEntityName" |
| static final Logger | log = Logger.getLogger(ERXEOEncodingUtilities.class) |
Static Protected Member Functions |
| static final NSDictionary | encodedEntityNames () |
Static Protected Attributes |
| static NSMutableDictionary | _encodedEntityNames = null |
Static Private Member Functions |
| static NSDictionary | processPrimaryKeyValue (String value, EOEntity entity, boolean isEncrypted) |
Static Private Attributes |
| static String | AttributeValueSeparator = "." |
| static String | EntityNameSeparator = "_" |
| static boolean | initialized |
| static boolean | SpecifySeparatorInURL = true |
Member Function Documentation
| static NSArray decodeEnterpriseObjectsFromFormValues |
( |
EOEditingContext |
ec, |
|
|
NSDictionary |
values | |
|
) |
| | [static] |
Decodes all of the objects for a given set of form values in the given editing context. The object encoding is very simple, just a generic entity name primary key pair where the key is potentially encrypted using blowfish. The specific encoding is specified in the method: encodeEnterpriseObjectsPrimaryKeyForUrl .
- Parameters:
-
| ec | editingcontext to fetch the objects from |
| values | form value dictionary where the values are an encoded representation of the primary key values in either cleartext or encrypted format. |
- Returns:
- array of enterprise objects corresponding to the passed in form values.
| static NSDictionary dictionaryOfFormValuesForEnterpriseObjects |
( |
NSArray |
eos, |
|
|
String |
separator, |
|
|
boolean |
encrypt | |
|
) |
| | [static] |
Constructs the form values dictionary by first calling the method encodeEnterpriseObjectsPrimaryKeyForUrl and then using the results of that to construct the dictionary.
- Parameters:
-
| eos | array of enterprise objects to be encoded in the url |
| separator | to be used to separate entity names |
| encrypt | flag to determine if the primary key of the objects should be encrypted. |
- Returns:
- dictionary containing all of the key value pairs where the keys denote the entity names and the values denote the possibly encrypted primary keys.
| static final NSDictionary encodedEntityNames |
( |
|
) |
[static, protected] |
This method constructs a dictionary with encoded entity names as keys and entity names as values.
- Returns:
- the shared dictionary containing encoded entity names.
| static String encodeEnterpriseObjectPrimaryKeyForUrl |
( |
EOEnterpriseObject |
eo, |
|
|
String |
seperator, |
|
|
boolean |
encrypt | |
|
) |
| | [static] |
Simple cover method that calls the method: encodeEnterpriseObjectsPrimaryKeyForUrl with an array containing the single object passed in.
- Parameters:
-
| 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. |
- Returns:
- url string containing the encoded enterprise object plus the entity name seperator used.
| static String encodeEnterpriseObjectsPrimaryKeyForUrl |
( |
NSArray |
eos, |
|
|
String |
separator, |
|
|
boolean |
encrypt | |
|
) |
| | [static] |
Encodes an array of enterprise objects for use in a url. The basic idea is is to have an entity name to primary key map that makes it easy to retrieve at a later date. In addition the entity name key will be able to tell if the value is an encrypted key or not. In this way given a key value pair the object can be fetched from an editing context given that at point you will know the entity name and the primary key.
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.
EncodedEntityName
You can specify an abbreviation for the encoded entityName. This is very useful when you don't want to disclose the internals of your application or simply because the entity name is rather long.
To do this:
-
open EOModeler,
-
click on the entity you want to edit,
-
get the "Info Panel"
-
go to the "User Info" tab (the last tab represented by a book)
-
add a key named EncodedEntityName with the value you want
- Parameters:
-
| eos | array of enterprise objects to be encoded in the url |
| separator | to be used between the entity name and a sequence number |
| encrypt | indicates if the primary keys of the objects should be encrypted |
- Returns:
- encoding of the objects passed that can be used as parameters in a url.
| static EOEnterpriseObject enterpriseObjectForEntityNamedFromFormValues |
( |
EOEditingContext |
ec, |
|
|
String |
entityName, |
|
|
NSDictionary |
formValues | |
|
) |
| | [static] |
Returns the enterprise object fetched with decoded formValues from entityName.
- Parameters:
-
| ec | the editing context to fetch the object from |
| entityName | the entity to fetch the object from |
| formValues | dictionary where the values are an encoded representation of the primary key values in either cleartext or encrypted format. |
- Returns:
- the enterprise object
| static NSArray enterpriseObjectsForEntityNamedFromFormValues |
( |
EOEditingContext |
ec, |
|
|
String |
entityName, |
|
|
NSDictionary |
formValues | |
|
) |
| | [static] |
Returns the enterprise objects fetched with decoded formValues from entityName.
- Parameters:
-
| ec | the editing context to fetch the objects from |
| entityName | the entity to fetch the objects from |
| formValues | dictionary where the values are an encoded representation of the primary key values in either cleartext or encrypted format. |
- Returns:
- the enterprise objects
| static NSArray enterpriseObjectsFromFormValues |
( |
EOEditingContext |
ec, |
|
|
NSDictionary |
formValues | |
|
) |
| | [static] |
- Deprecated:
- use
decodeEnterpriseObjectsFromFormValues instead
| static String entityNameDecode |
( |
String |
encodedName |
) |
[static] |
Decodes the encoded entity name.
- Parameters:
-
| encodedName | the encode name. |
- Returns:
- decoded entity name.
| static String entityNameEncode |
( |
EOEnterpriseObject |
eo |
) |
[static] |
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.
- Parameters:
-
- Returns:
- the encoded entity name defaulting to the given eo's entityName
| static String entityNameSeparator |
( |
|
) |
[static] |
| static NSDictionary groupedEnterpriseObjectsFromFormValues |
( |
EOEditingContext |
ec, |
|
|
NSDictionary |
formValues | |
|
) |
| | [static] |
Returns enterprise objects grouped by entity name. The specific encoding is specified in the method: encodeEnterpriseObjectsPrimaryKeyForUrl - Parameters:
-
| ec | the editing context to fetch the objects from |
| formValues | dictionary where the values are an encoded representation of the primary key values in either cleartext or encrypted format. |
- Returns:
- enterprise objects grouped by entity name
| static synchronized void init |
( |
|
) |
[static] |
| static boolean isSpecifySeparatorInURL |
( |
|
) |
[static] |
| static NSDictionary processPrimaryKeyValue |
( |
String |
value, |
|
|
EOEntity |
entity, |
|
|
boolean |
isEncrypted | |
|
) |
| | [static, private] |
Generates an NSDictionary representing primary key values, both simple and compound. If values are encrypted we try to create the correct attribute value type. Supported types are: strings, numbers, timestamps and custom attributes with a factory method using a string argument.
- Parameters:
-
| value | the primary key value, either a single value or a collection |
| entity | the entity used to gather primary key information |
| isEncrypted | yes/no |
- Returns:
- a dictionary with primary key values
| static void setEntityNameSeparator |
( |
String |
entityNameSeparator |
) |
[static] |
| static void setSpecifySeparatorInURL |
( |
boolean |
specifySeparatorInURL |
) |
[static] |
Member Data Documentation
This dictionary contains the encoded entity names used in the defaultGroup
Holds the attribute value separator used when objects with compound keys are encoded into urls. Its value is: .
Key used in EOModeler to specify the encoded (or abbreviated) entity named used when encoding an enterprise-object is an url.
Holds the default entity name separator that is used when objects are encoded into urls. Default value is: _ and it must not equal AttributeValueSeparator
final Logger log = Logger.getLogger(ERXEOEncodingUtilities.class) [static] |
The documentation for this class was generated from the following file: