Methods for sending additional data
There are three main methods for sending additional data: Adding data to the UserData element of a BOD, Extending a BOD, Creating a new BOD.
- Adding data to the UserData element of a BOD
- Achieved by adding name/value pairs to the userData element of the BOD message
- Requires no schema changes
- Extending a BOD
- Achieved by extending the model object provided with WebSphere Commerce
- Requires schema changes and use of the extension point framework
- Creating a new BOD
- Achieved by creating a new model object
- Requires a new schema and associated request builder
Adding data to the UserData element
- Advantages
- Requires no schema changes
- Fields are automatically mapped on WebSphere Commerce side
- Disadvantages
- Limited amount of data can be passed
- Restricted to name-value pairs
- Difficult with record data - lists of repeating data
<wc:CommerceArea> <wc:StoreId>0</wc:StoreId> </wc:CommerceArea> <wc:UserData> <wc:UserDataField name="userField1">This is text</wc:UserData> <wc:UserDataField name="userField2">This is more text</wc:UserData> </wc:UserData> </wc:Logon>
Extending the UserData element
To add additional name-value pairs for Create or Sync BODs
- Add parameters to the model object
- Passed to service request handler via TelesalesProperties
- Properties marked as user data are added automatically to the UserData element
- <ModelObject>.setData()
- Add the field to the user data property
- <ModelObject>.addUserDataProperty()
- Example: Customer.addUserDataProperty
protected TelesalesProperties getCreateCustomerParameters() { TelesalesProperties parms = super.getCreateCustomerParameters(); Customer customer = (Customer) parms.get("customer"); customer.setData("userField1", "custom data"); customer.addUserDataProperty("userField1"); return parms; } <wc:UserData> <wc:UserDataField name="userField1">custom data</wc:UserData> </wc:UserData>
- Use the appropriate extension point
- Example: Editor extension point
- <ModelObject>.addUserDataProperty() Example: Customer.addUserDataProperty
<editor name="customerEditorName" icon="" id="extensions.customerEditor"> </editor>
- Use the configuration editor to support the customization
- Example: com.ibm.commerce.telesales.customerEditor=extensions.customerEditor