Enabling Custom Actions by using Entry Preview scripts

You can enable Custom Actions in the Persona-based UI by using Entry Preview scripts.

Before you begin

For Custom Actions support, you should first install and configure Hazelcast.

Procedure

  1. Create an implementation class for entry preview extension point which implements EntryPreviewFunction.
  2. Implement entryPreview() method so that it writes a servlet URL in PrintWriter.write().
    For example,
    String url = "/redirect.wpc?itemList=" + itemDetails
    + "&containerName=" + catalogName;
    printWriter.write(url);
  3. Create a servlet which implements AsyncEnabled and RequestResponseEnabled interfaces.
  4. Create servlet and JSP mapping in the flow-config.xml file.
    <flow path="redirect" command="com.test.Redirect" method="entryPoint">
    <flow-dispatch name="ok" location="/user/entryPreview.jsp" dispatchType="forward" />
    </flow>
  5. Create a JSP to render response from servlet and place the JSP in the $TOP/public_html/user folder.
  6. In the entry preview extension point pass parameters as query params to servlet URL.
  7. Read the params from request in servlet as set in the previous step.
  8. Set the ids in request params or HTTP Session in the servlet so that they are available to subsequent requests like JSP.
    Important: Due to these changes, the same entry preview script no longer works in the Admin UI.
  9. Create a JAR for compiled extension code and place it in classpath for the Admin UI:
    1. Add custom JAR entry in the $TOP/bin/conf/classpath/jars-custom.txt file.
    2. Run the $TOP/bin/conf/updateRtClasspath.sh file.
  10. Create a JAR for compiled extension code and set the classpath in the Websphere Application Server for the Persona-based UI.
    Servers > Server Types > > WebSphere Application servers > mdmui > Java and Process Management > Process definition > Java Virtual Machine
  11. Restart the Admin UI and the Persona-based UI Servers.
  12. In the Admin UI, create an entry preview script in theScript Console of the Admin UI.
    1. Click New, and then select container type, Catalog, and input parameter specs.
    2. Select ASP/JSP like as the selected type.
    3. Write a script body containing JSP URL in the IFRAME:
      <%
      var pk;
      forEachEntrySetElement(entrySet, entry)
      {
      pk = entry.getEntryId();
      break;
      }
      %>
      <html>
      <body>
      <iframe src="/user/SamplePage.jsp?mdmId=<%=pk%>" style="position:absolute;top:0;left:0;width:100%;height:100%;">
      </iframe>
      </body>
      </html>
    4. Add the following Java API URL , and save the script.
      //script_execution_mode=java_api="japi://com.test.EntryPreviewTest.class"
    5. Copy the JSP file to the $TOP/public_html/user folder.

Results

Select an item from the Catalog Explorer or a collaboration area and Click Action list to select the configured script. The configured scripts runs and resulting JSP is displayed in a pop-up window.