This concept describes the UserPreference table available from Intershop Commerce Management 7.10.35.
The UserPreference table is a commonly usable table for storing user-specific configurations. I.e. user data should not be stored as custom attribute (BasicProfile_AV), but as UserPreference.
Furthermore, optional user preference data is included in the customer import and export.
The UserPreference table does not store localized values, so in some cases custom attributes may be the only option.
A user is related to a customer, see references documents below for details.
The data of a registered user in ICM (Intershop Commerce Management) is stored as BasicProfile and the user's custom attributes as BasicProfile_AV.
This table is used to store user-related data. (e.g.: configurations, etc.). It only stores non-localized string values. However, the GroupName or the name can contain a LocaleID.
The combination of profileUUID, groupName and name are used as PrimaryKey in the table UserPreference.
The stringValue attribute contains the actual data which can be a maximum of 4000 characters long.
The attributes LastModified and OCA are used for internal purposes.
Each User(BasicProfile) can have multiple UserPreference table entries.
The UserPreference.profileUUID provides the weak relation to the BasicProfile with its UUID.
At ORM level a UserDeleteObserver object is registered as ObjectListener with the BasicProfilePOFactory.
This removes all user-related UserPreference table entries before the User(BasicProfile) itself gets deleted.
When BasicProfile data is removed by database delete queries, the corresponding UserPreference table entries are not removed.
There is currently no way in Intershop Commerce Management to remove entries by query, but custom project code could do this. As a workaround, refer to Cookbook - UserPreference Table | Recipe: Remove Orphaned DB Entries.
For accessing data in the UserPreference table in Java code, use the UserBO extension described in the next section.
To read the data in ISML templates, simply use a UserBO extension method, and for pipelines, use a KeyMapper to extract the required data.
Writing UserPreference data is implemented via the UpdateUserBOPreferences pipelet which allows saving data to preferences. It delegates to the setPreference method of the UserBO extension as described in the next section.
Furthermore three optional parameters are available:
|Pipelet Parameter Name||Description|
|UserPreferenceName||Translates to setPreference method parameter - name|
|UserPreferenceGroup||Translates to setPreference method parameter - group|
|UserPreferenceValue||Translates to setPreference method parameter - value|
The API of the UserBO java extension UserBOPreferencesExtension features four methods for accessing the UserPreference table:
|void setPreference(String name, String group, String value)|
|void removePreference(String name, String group)|
|String getPreference(String name, String group)|
|Map<String, String> getPreferencesByGroup(String group)|
Do not use this method excessively. It can cause performance issues.
The customer import was extended to import data stored in the UserPreference table.
The optional tag <user-preferences> and its <user-preference ...> sub-tags contain the user preference data.
The customeruser.xsd located in (f_business\f_checkout\bc_customer\staticfiles\) share\system\impex\schema\customeruser.xsd has been extended.
... <!-- Profile --> <xsd:complexType name="complexType.Profile" mixed="false"> <xsd:choice minOccurs="0" maxOccurs="unbounded"> ... <xsd:element name="user-preferences" type="complexType.Profile.UserPreferences" minOccurs="0" maxOccurs="1" /> </xsd:choice> </xsd:complexType> ... <!-- user preferences --> <xsd:complexType name="complexType.Profile.UserPreferences" mixed="false"> <xsd:sequence> <xsd:element name="user-preference" type="complexType.Profile.UserPreference" minOccurs="0" maxOccurs="unbounded" /> </xsd:sequence> </xsd:complexType> <xsd:complexType name="complexType.Profile.UserPreference" mixed="true"> <xsd:sequence> <xsd:element name="value" type="simpleType.Generic.String.4000" minOccurs="0" maxOccurs="1"/> </xsd:sequence> <xsd:attribute name="name" type="simpleType.Generic.String.256" use="required" /> <xsd:attribute name="group" type="simpleType.Generic.String.256" use="required" /> </xsd:complexType> ...
For testing purposes, the demo customer OilCorp - user cxmluser(@test.intershop.de) comes with user settings that are imported during DBInit.
Those user-preferences configurations were added for cXML Punchout tests. Hence the common user-preference group cxml.
<user business-partner-no="cxmluser"> <business-partner-no>cxmluser</business-partner-no> <profile> <credentials> <login>firstname.lastname@example.org</login> ... </credentials> ... <user-preferences> <user-preference name="unitmapping" group="cxml">EACH;pcs BOX;box DOZ;DOZEN</user-preference> <user-preference name="punchout.locale" group="cxml">en_US</user-preference> </user-preferences> </profile> ... </user>
Since customer and user are usually created in a live ICM environment, the UserPreference table is not part of the staging (mass data replication).
The information provided in the Knowledge Base may not be applicable to all systems and situations. Intershop Communications will not be liable to any party for any direct or indirect damages resulting from the use of the Customer Support section of the Intershop Corporate Web site, including, without limitation, any lost profits, business interruption, loss of programs or other data on your information handling system.