Develop > Presentation layer > Customize IBM Sales Center > WebSphere Commerce integration > Userdata changes in support of command extension


Extend the UserData element

Use the UserData element when to use the extra fields in the database to add new custom data to the existing Sales Center messages without making any changes to the WebSphere Commerce Server and without changing the schema definition of the request/response business object document (BOD).

To add additional name-value pairs to the UserData element:


Procedure

  1. Add the parameters to the model object that is being passed to the service request handler through the TelesalesProperties. Any properties marked as being user data properties will be added to the UserData element automatically. Ensure that you use the ModelObject.addUserDataProperty method to indicate that a property should be included in the UserData element. In this example, the ModelObject is Customer, and a new parameter "userField1" is passed to the create user request using the UserData element on the Business Object Document. This is part of an extension of the customer editor:

    package extensions; 
    import com.ibm.commerce.telesales.core.TelesalesProperties; import com.ibm.commerce.telesales.model.Customer; import com.ibm.commerce.telesales.ui.impl.editors.CustomerEditor; 
    public class ExtendedCustomerEditor extends CustomerEditor {
    
            protected TelesalesProperties getCreateCustomerParameters()
    {
                    TelesalesProperties parms =
    super.getCreateCustomerParameters();                 Customer customer = (Customer)
    parms.get("customer");                 customer.setData("userField1", "custom data");                 customer.addUserDataProperty("userField1");                 return parms;         }
    }
    

  2. Use the appropriate extension point to support the customization. In this example we are sending custom data from the customer editor, so we use the editors extension point:

    <?xml version="1.0" encoding="UTF-8"?>
    <?eclipse version="3.0"?>
    <plugin> 
      
    <extension
    point="com.ibm.commerce.telesales.configurator">      
    <configurator path="config"/>   
    </extension>   
    <extension
             point="org.eclipse.ui.editors">      
    <editor
                name="customerEditorName"
                icon=""
                
                id="extensions.customerEditor">      
    </editor>   
    </extension> 
    </plugin>
    

  3. Use the system configurator to support the customization of the user interface element that is sending the additional data. In this example we are sending the additional data from the customer editor:

    com.ibm.commerce.telesales.customerEditor=extensions.customerEditor
    


Results

The steps mentioned above are necessary to reflect back the customization that user has done. That is, to show the customized UI rather than the default UI, and customer.setdata are used to set the appropriate key value pair so that server can recognize that as a part of UserData.


Related concepts

Userdata changes in support of command extension

Service request handlers


+

Search Tips   |   Advanced Search