Management Center business object UserData

Use the UserData element in the request and response BODs for an existing Management Center object to add data to the object. By using the built-in UserData support for objects, you can quickly customize Management Center to display and use custom data for objects. For instance, if you want to include custom property fields for a product, such for including product warranty information, you can use the UserData element.
Note: The Management Center web application does not require any changes for this type of customization.

If you require more data in a noun and Management Center object, you can use UserData. UserData is used as a data extension point for adding data for objects without changing your WebSphere Commerce logical model. UserData must use parameters with the format prefix_name, where the prefix must begin with the letter x and identifies the field as UserData. The name is the name of the UserData field. Since a noun can have UserData at multiple levels, you must append an identifier to the x prefix to distinguish between UserData that has the same field name at different levels of a noun. For instance, xattr_, xdesc_, and xattrdesc_.

If you use UserData, your configuration must include definitions for how to handle the mapping of the UserData. UserData can be identified through different prefixes that are based on where the UserData is in the noun. For example, in the configuration for catalog objects, xasso_ indicates the UserData comes from merchandising associations, or xattr_ for attributes. As an example, UserData for a catalog object can begin with the prefix x_, which has its mapping, which is defined in the catalog component configuration file, wc-catalog-clientobjects.xml. In this file, the mapping of UserData with the prefix x_ is defined with the following code snippet.

<_config:URLParameter name="x_" nounElement="/UserData/UserDataField" type="UserData"/>
Where the type="UserData" code identifies that URL parameters that begin with the prefix x_ are mapped to the element in the catalog entry noun that is defined by the XPath: /UserData/UserDataField.
Note: Including an underscore ( _ ) character in the name for user defined request attributes is not supported.
If you customize Management Center to add UserData into an existing noun, the UserData must be transformed into an XML object. The serialization JSP fragments that are provided by default can serialize new UserData values for existing nouns. This default serialization support ensures that UserData can be included in Management Center XML objects that are provided by default. The following code snippet shows the structure for this UserData within a serialization JSP fragment that is used to transform the data.

<c:forEach var="userDataField" items="${catalogEntry.userData.userDataField}"> 
  <xdesc_${userDataField.typedKey}>${userDataField.typedValue}</xdesc_${userDataField.typedKey}>
</c:forEach>
When a URL request is generated, the URL parameters are compared with the configuration file definitions to get the instructions for mapping the parameters to the associated noun elements. If the URL request requires an updated Management Center object to be returned, the noun is then transformed into the object model XML that is required by Management Center.

If this new property must display to business users, you can customize Management Center to display the data as an object property. For an example of customizing Management Center to display UserData for an object, see Tutorial: Adding fields in the Catalogs tool.