Business objects (BOs) implement the software's business logic. They are responsible for handling data objects (constructing, loading, saving, deleting) and any other business logic related to the business module. For every data object, there is a business object that handles it. Business objects offer services to the Controller layer (UI, API, Process) but they do not implement any process flows.
In CRM.COM Software, business object classes are implemented using EJBs (Enterprise Java Beans) J2EE server-side components, and more specifically, Stateless Session Beans. More information about EJBs can be found here.
Creating the Business Object Classes
All business objects should be placed under com.crm.businessobject.* named packages and extend com.crm.businessobject.CRMBO.
Defining Bussiness Object Methods
To implement the basic business logic in our class, we will need to create the following methods:
This method creates a new instance of the data object. In this method we add any business logic required when creating a new entity. The mainDTO parameter is not null in case the data object to be created should be related with another data object.
This method saves the data objects to the database. In this method we add any business logic required to be executed when saving an entity.
This method deletes the data objects. In this method we add any business logic required to be executed when deleting an entity. Note that records are not physically deleted but marked as deleted.
This method validates the data objects before saving to the database. Any validations that should be done before saving the data object to the database should be performed in this method.
This method validates the data objects before saving to the database as deleted. Any validations that should be done before deleting the data object should be performed in this method.
This method returns the class of the data object that is handled by the specific business object. It is used mainly to construct the HQL (Hibernate Query Language) dynamically.
This method returns a list of the associated data objects that should be loaded by default when loading a data object. It is called by abstract functionality to load the data objects associated data objects.
This method returns a sequence number that is set on the data object in case it has a number property. It is called by abstract functionality to set the data object's number when saving the data object.
This method returns a list of the data object's mandatory fields (fields that should be always set). This method is called by abstract functionality to validate that all mandatory fields are set.
To start implementing the controller layer, go to Developing the Controller layer