IBM Cúram – Customize Pre and Post Data Access for Entity


Introduction


IBM Cúram has customization guidelines which have to be followed by every client in order to maintain compliance with the product. An OOTB code should customize as per provided guideline because it impacts product upgrade in the future.
The Entity customization is weird as it has a different approach based on the customization code. The Entity insert records based on Classic and PI(Persistence Infrastructure) approach and customization is different in both the cases.


Pre & Post Data Access For PI


Pre and Post Data access is a way to enable a hook point for an OOTB code so that the customer can execute some business logic before and after the insertion of records on a specific entity.
The best usage of this feather comes when the clients want to add some more attribute on an OOTB entity or want to execute some process before and after the insertion of data. The clients cannot add an attribute directly to an OOTB entity.
The client has to follow the customization guideline to enable the hook points, please follow steps to generate Pre and Post Insert method when it is PI.


  • Search the OOTB Listener Interface which created for Pre and Post Data Access. Most of the time it name will be like EntityNameInsertEvents.

  • Once interface search completed then create a class with the same name plus prefix (You can give any name but it should be more readable so the purpose of this class can be identified by the name itself.)

  • Once the class created then implements an OOTB interface which we searched in our previous step. It will ask to add unimplemented methods. We have to implement business logic on postInsert & preInsert method.


  • Now check Module.java available in your custom folder or not, if it is not available then create a new one with some prefix or any name. Once Module.java created then write the binding code inside that with your custom class and OOTB interface.

binder().bind(Sample.class).to(NFSampleImpl.class)


  • Also, We have to add Module.java in MODULECLASSNAME.dmx file.

<row>

  <attribute name="moduleClassName">

    <value>curam.xyz.KWModule</value>

  </attribute>

</row>


  • Test the functionality to make sure that it executes client-specific business logic along with an OOTB functionality.

Pre & Post Data Access For Classic


Developing and maintaining entity features through Model is called a Classic way of development. The IBM Cúram uses the RSA to develop the model so that most of the code generates through the model and developer can concentrate on the business logic.
The classic way is most useful and highly used features in IBM Cúram. Please follow steps below to enable Pre and Post Data Access operation on the entity.


  • Model an entity class using the <<entity>> stereotype and add the standard operation for which Data access required like insert, modify and remove.

 


  • Once class with operations are ready, Click on the standard operation and navigate to properties in RSA editor.
    if you want to enable, please follow below table –
Property Value Comments, if any
Pre_Data_Access 1 – yes This will enable the preInsert operation for entity.
Post_Data_Access 1 – yes This will enable the postInsert operation for entity.
On_Fail_Operation 1 – yes This will enable the operation to add business logic when insertion into the entity failed.


  • Once above properties configured then save the changes in RSA and create a Class Diagram to establish a subclass association.


  • Drag and Drop the Parent and Child entity on  the class diagram and establish the Generalization from child to entity class.

 


  • Once the above steps completed, execute the build generated ANT command to generate the artifacts.

  • Verify all new artifact generated for you custom subclass and it should generate –
    • Interface
    • Base Class
    • Factory

  • It would not generate an implementation class and developer has to generate the implementation class and write the business logic


  • Once above steps are completed, Start all required server and test the functionality.

Hope you understand and like it!

Leave a Reply

Your email address will not be published. Required fields are marked *