Custom screen and custom control plugins

Custom screen and custom control plugins

Custom plugins can be deployed just as for Web Determinations, by placing the .jar file into the WEB-INF\classes\plugins directory of the opa-interview-portlet web application. More detailed information about plugins can be found in the topic Customize the existing Web Determinations user experience.

The following are portlet-specific plugin considerations:

Custom screens

Custom screens for the portlet are developed using the same methodology as custom screens for Web Determinations, with the following restrictions:

 

The portlet custom screen example (Example: Create a Custom Screen for the Interview Portlet) provides an example on how to implement redirects, including external redirects, in a custom screen for the portlet.

Custom controls

If your custom control needs to place a hyperlink on the page (for example, to link to another interview screen), the control Java code needs to use URL Rewriter to obtain a URL encoded for the portal server. Specifically, you need to use:

com.oracle.determinations.web.platform.controller.URLRewriter.getURL().

You can obtain an instance of the URL Rewriter using com.oracle.determinations.web.platform.controller.SessionContext.getCustomURL(). More information about the URL Rewriter can be found in the Javadoc (see the help\api directory of OPA Help).

As an example, the following Java code allows a custom control to build a URL for the summary screen (this is an additional method for the BenefitCodeControl class found in the topic Custom Control - BenefitCode Walkthrough Example:

/**
 * An example of how to get a portlet URL for the summary screen, using the URL rewriter
*/
public String getCustomURL() {
        SessionContext ctx = screen.getSessionContext();
        URI summaryURI = new URI(
                "screen",
                ctx.getInterviewSession().getRulebase().getIdentifier(),
                ctx.getInterviewSession().getLocale(),
                ctx.getSecurityToken().getIdentifier(),
                ctx.getCaseID(), new String[]{EngineConstants.DEFAULT_SUMMARY_SCREEN_NAME}
        );
        return ctx.getURLRewriter().getURL(summaryURI, false);
}

The following needs to be inserted in the respective Velocity template for this custom control:

<a href="${control.getCustomURL()}">Click here to go to the summary screen</a>