August 7, 2012

Overwriting default functionalities like Save, Load of OPA

In OPA, we can modify the default functionalities like Save, Load etc. One example use case for the need of doing this is, by default in OPA if we click on Save, the data will be saved in an xml file, but if we want to save the data in other services like data base or BPM then we are required to overwrite the Save functionality of the OPA.

To overwrite the default functionalities of the OPA like Save, Load etc, follow the below steps

  • Write a java class by implementing an interface “”
The interface contains the below abstract methods

public InterviewUserData load(SecurityToken securityToken, String string,
                                  InterviewRulebase interviewRulebase)
public String[] listCases(SecurityToken securityToken,
                              InterviewRulebase interviewRulebase)
public String save(SecurityToken securityToken, String string,
                       InterviewSession interviewSession)
public boolean dataAdaptorProvidesCaseID()
public InterviewSessionPlugin getInstance(InterviewSessionRegisterArgs interviewSessionRegisterArgs)

  • According to the functionality to be overwritten, we can choose the method and add the desired code to it. For example, if we want to change save functionality of OPA, write the code in the save() method
  • Make jar file to the project and copy the jar file to the path “\Release\web-determinations\WEB-INF\classes\plugins” of OPA project and run the OPA project

Note: If we implement the interface, it will overwrite all the functionalities it supports. The OPA expects us to implement those functionalities.