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
- Create an implementation class for entry preview extension point which implements
EntryPreviewFunction
.
- 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);
- Create a servlet which implements
AsyncEnabled
and
RequestResponseEnabled
interfaces.
- 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>
- Create a JSP to render response from servlet and place the JSP in the
$TOP/public_html/user
folder.
- In the entry preview extension point pass parameters as query params to servlet
URL.
- Read the params from request in servlet as set in the previous step.
- 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.
- Create a JAR for compiled extension code and place it in classpath for the Admin UI:
- Add custom JAR entry in the
$TOP/bin/conf/classpath/jars-custom.txt
file.
- Run the
$TOP/bin/conf/updateRtClasspath.sh
file.
- Create a JAR for compiled extension code and set the classpath in the Websphere
Application Server for the Persona-based UI.
- Restart the Admin UI and the Persona-based UI Servers.
- In the Admin UI, create an entry preview
script in theScript Console of the Admin UI.
- Click New, and then select container type, Catalog, and input
parameter specs.
- Select ASP/JSP like as the selected type.
- 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>
- Add the following Java API URL , and save the script.
//script_execution_mode=java_api="japi://com.test.EntryPreviewTest.class"
- 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.