Modifying the business logic layer

You need to define two classes in the business logic layer: the business object and the business component.

About this task

This is part of the larger task of Creating a hard product type.

For the deposit product example, the two classes you need to define are DepositProductBObj and CustomProductComponent.

Procedure

  1. Define the DepositProductBObj class

    The subtype depends on which product type you are extending. For the deposit product type, you would subtype FinancialProductBObj since the deposit product type is a type of financial product. Because it is a subtype, it does not have its own depositProductId; the productId of ProductBObj is used as the ID for all subtypes.

    New hard product types must always extend from existing hard types. InfoSphere® MDM comes with five products that can be extended from: ProductBObj, GoodsProductBObj, FinancialProductBObj, ServiceProductBObj, and InsuranceProductBObj. After you define your own custom hard product types, you can also extend from them in the same way.

    Continuing with the DepositProduct scenario, you would first extend from the existing FinancialProductBObj as follows:
    public class DepositProductBObj extends FinancialProductBObj {
     ....
     }
    
    After you've created the DepositProductBObj business object, you can then extend it to create another new hard product type named MyDepositProductBObj, as follows:
    public class MyDepositProductBObj extends DepositProductBObj {
     .... 
    }
    
  2. Create a new class CustomProductComponent.
    Follow the existing coding pattern to create the class so that it that extends from the existing component file, ProductComponent, and adds new persistent methods (add or update) and an inquiry method (get). The following is the logic for an add transaction in the method handleAddDepositProduct:
    1. Retrieve and set the pluggable key.
    2. Retrieve the concrete product type of the product that is processing (for example, if MySoftFinancialProduct is a soft product type and its parent product type is FinancialProduct, which is the hard type, then the concrete product type for MySoftFinancialProduct is FinancialProduct (ProductTypeId=4). Validate that the concrete product type matches the newly defined product type.
    3. Define a new method, processDepositProduct, which takes the new product type BObj as an input signature and returns the same BObj.

What to do next

Now that you are done modifying the business logic layer, the next task you need to perform is Modifying the controller layer.