...
Expand | ||
---|---|---|
| ||
|
Defining
...
Basic BO Methods
To implement the basic business logic, the following methods must be created:
...
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
/** * Returns the mandatory fields of a bank branch. * * @param dto - the bank branch to return the mandatory fields for * @return the mandatory fields of the bank branch * @throws Exception */ @Override protected LinkedHashMap<String, String> getMandatoryFields(CRMDO dto) throws Exception { LinkedHashMap<String, String> mandatoryFields = new LinkedHashMap<String, String>(); mandatoryFields.put("key_name", "name"); mandatoryFields.put("key_alternative_code", "altCode"); return mandatoryFields; } |
Defining Additional BO methods
In most cases, the basic business object methods are not enough and some additional methods need to be created.
In the following examples load(String criteria, ArrayList values, ArrayList<String> associations, String orderBy, Integer maxSize) method of com.crm.businessobject.platform.CRMBONumberSchemeBean is used to load the list data objects based on the given criteria.
HQL must be used to construct the criteria string parameter.
This method returns a list of bank branches of a given bank.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
/**
* Loads a list of bank branches of a bank.
*
* @param bank - the bank to load the branches for
* @return a list of bank branches of the bank
* @throws Exception
*/
public ArrayList<CRMDO> load(CRMDOBank bank) throws Exception {
ArrayList<String> values = new ArrayList<String>();
values.add(bank.getId());
return load(
getDOName().toLowerCase() + ".bank.id=:p1 and " +
getDOName().toLowerCase() + ".isDeleted=0",
values,
getDefaultAssociations(),
null,
null);
} |
This method loads the bank branch having the given alternative code.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
/**
* Loads a bank branch by an alternative code.
*
* @param altCode - the alternative code to load by
* @param associations - a list of associated objects
* @return a bank branch with the given alternative code
* @throws Exception
*/
public CRMDOBankBranch loadByAltCode(String altCode, ArrayList<String> associations) throws Exception {
ArrayList<String> values = new ArrayList<String>();
values.add(altCode);
return (CRMDOBankBranch)load(
getDOName().toLowerCase() + ".altCode=:p1 and " +
getDOName().toLowerCase() + ".isDeleted=0",
values,
associations);
} |
To start implementing the controller layer, go to Developing the Controller layer