Adding a model object
The data model is used to cache business objects on the client.
About this task
To add a model object to the model:
Procedure
- Create a new class which should extend ModelObject class defined in com.ibm.commerce.telesales.core plug-in.
- Register the newly created model object using the model object extension point.
- Use the TelesalesModelObjectFactory.createModelObject method
to construct new instances of this model class wherever required. For
example: CustomModelObject
modelObject = (CustomModelObject) TelesalesModelObjectFactory.createModelObject(
"ID_OF_CustomModelObject" ); Note: The ID of CustomModelObject used
above is defined while registering this class in the extension point.
<extension point="com.ibm.commerce.telesales.core.modelObjects"> <modelObject id="ID_Of_CustomModelObject" class="package.CustomModelObject"/> </extension>
- Add instances of your new class to the model as properties of other model objects. If your model object will be at the root level, then add it as a property of ModelRoot. If your model objects are actually a list of model objects, then you can use the ModelObjectList to group your model objects into a list. Add ModelObjectList as a property of the parent object ModelObject.