Example: Create a Custom Screen for the Interview Portlet

This example illustrates how to develop a custom screen to be used in the Oracle Policy Automation Interview Portlet. Specifically, it shows:

 

The source code for the example is available in the examples/interview-portlet/custom-screen directory of the Java runtime zip. The corresponding rulebase can be found at examples/rulebases/compiled/CustomScreenExample.zip; the example source code consists of the following three classes:

ExampleScreen

This class implements the CustomScreen interface and is responsible for rendering the screen (processAndRespond method), as well as processing POST data submitted to the screen (submit method).

Importantly for the portlet, the processAndRespond method is invoked during the Render phase of the portlet and therefore is not able to issue external redirects. It can either return a DisplayScreenResponse or a RedirectResponse to another URI within the portlet.

ExampleScreenProvider

The Web Determinations platform looks for this class each time a screen is to be displayed. It determines if the screen to be displayed will be replaced by a custom screen, and if so, returns an instance of ExampleScreen.

ExternalRedirector

This class is an event handler for the portlet's OnAfterProcessActionEvent. Depending on whether the value of a certain rulebase attribute is set, it replaces the response about to be rendered with an ExternalRedirectResponse. The portlet then consumes this ExternalRedirectResponse and issues an external redirect just before the end of the action phase.