book
Article ID: KB0090540
calendar_today
Updated On:
Description
Resolution:
Description:
============
Method for creating a check box on the ProductEditApproval work item page and subsequently handling the output from the checkbox after the work item page is submitted back to the workflow that initiated the work item.
Environment:
============
TIBCO Collaborative Information Manager (CIM) 8.2.1
Cause:
======
In configuring CIM, it is sometimes useful to add extra fields to the ProductEditApproval work item page whose output can be used in a workflow step immediately after the CREATEWORKITEM step to make a decision on what to do next
Resolution:
===========
To create a check box on a work item page (in this case, for the ProductEditApproval page, although the general approach is the same for all XMLC generated web-pages in CIM):
Note: In what follows, if using Windows, change the syntax accordingly, that is use \ instead of /, %..% instead of $.. and ".bat" instead of ".sh".
Also, downloads are available from SR_Id:1-DN9K5B)
1). First, you need the correct templates. Once you have the template zip file, unzip the template file to a directory on the CIM server.
Locate the file under the unzipped directory:
./workitem/templates/ProductEditApproval.html
The HTML page this file contains will become the generated Java class:
com.tibco.mdm.ui.workflow.engine.workitem.templates.ProductEditApproval.class
that will replace the existing class of the same name in ECM.ear / ECMClasses.jar
2). Having downloaded the templates, if it does not already exist, create the directory:
$MQ_HOME/thirdparty
Copy down the file thirdparty.zip and unzip the file to $MQ_HOME/thirdparty This directory should now directly contain the following jar files:
com.ibm.mq.jar com.ibm.mqjms.jar jsse.jar xmlc-all-runtime.jar xmlc-chtml.jar xmlc-taskdef.jar
com.ibm.mq.jmqi.jar gnu-regexp.jar tibjms.jar xmlc-base.jar xmlc.jar xmlc-xerces.jar
3). Check that the following environment variables have been defined:
OS : Linux / Windows / Solaris / AIX
JAVA_HOME : Location of Java JDK installation
ANT_HOME : $MQ_HOME/bin/buildTool (Location of ant libraries)
ORACLE_HOME : |
DB2_HOME : +- One of these, depending on your database
WAS_HOME : |
PATH : add $MQ_HOME/bin/buildTool/bin
CUST_DEVROOT : $MQ_HOME/build/custom/root (this is where the html and xml files will be placed)
DEVROOT : $MQ_HOME/build/custom/root
MQ_HOME : CIM Install Root
MQ_LOG : CIM LOG directory
MQ_COMMON_DIR : CIM common directory
4). Once the variables are defined, go to the directory $MQ_HOME/build/custom and execute the customutil script:
customutil.sh -createDirStructure (just creates directories - ignore any errors)
Under Linux / unix / AIX / Solaris, it may be necessary to chmod +x customutil.sh to change permissions for it to become executable.
5). Copy the ProductEditApproval.class file to the $CUST_DEVROOT/com/tibco/mdm/ui/workflow/engine/workitem/templates directory (create the path, if necessary).
6). Copy the $MQ_COMMON_DIR/standard/forms/fm26ca.xml XMLC form to $MQ_COMMON_DIR/standard/forms/fm26ca_mod.xml . Uou may eventually want to locate this elsewhere.
7). Edit the ProductEditApproval.class file. Change:
<TR id="TRASSOCPRODUCTSTABLE">
<TD>
<DIV class="subheaderContentsDiv">
<TABLE cellpadding="0" cellspacing="0" class="contentsTableWithGrid" id="ASSOCPRODUCTSTABLE" summary="">
<TR>
<TD class="actionToolbarTD" id="actionToolbarTD" colspan="5">
<DIV id="actionToolbarContainer" class="actionToolbarContainer">
<a class="lnkWithImgAndText toolbarButtonDisabled" href="#" id="ASSOCPRODUCTVIEWLINK">
<img src="images/view_16x16.gif">
<span id="ASSOClinkViewText">view</span>
</a>
<a class="lnkWithImgAndText toolbarButtonDisabled" href="#" id="ASSOCPRODUCTEDITLINK">
<img src="images/edit.gif">
<span id="ASSOClinkModifyText">modify</span>
</a>
<a class="lnkWithImgAndText toolbarButtonDisabled" href="#" id="ASSOCREJECTIONEDITLINK">
<img src="images/review_16x16.gif">
<span id="ASSOClinkReviewText">review</span>
</a>
<a class="lnkWithImgAndText toolbarButtonDisabled" href="#" id="ASSOCCOMPARELINK">
<img src="images/compare_records_16x16.gif">
<span id="ASSOClinkCompareText">compare</span>
</a>
</DIV>
</TD>
</TR>
To:
<TR id="TRASSOCPRODUCTSTABLE">
<TD>
<DIV class="subheaderContentsDiv">
<TABLE cellpadding="0" cellspacing="0" class="contentsTableWithGrid" id="ASSOCPRODUCTSTABLE" summary="">
<TR>
<TD class="actionToolbarTD" id="actionToolbarTD" colspan="5">
<DIV id="actionToolbarContainer" class="actionToolbarContainer">
<a class="lnkWithImgAndText toolbarButtonDisabled" href="#" id="ASSOCPRODUCTVIEWLINK">
<img src="images/view_16x16.gif">
<span id="ASSOClinkViewText">view</span>
</a>
<a class="lnkWithImgAndText toolbarButtonDisabled" href="#" id="ASSOCPRODUCTEDITLINK">
<img src="images/edit.gif">
<span id="ASSOClinkModifyText">modify</span>
</a>
<a class="lnkWithImgAndText toolbarButtonDisabled" href="#" id="ASSOCREJECTIONEDITLINK">
<img src="images/review_16x16.gif">
<span id="ASSOClinkReviewText">review</span>
</a>
<a class="lnkWithImgAndText toolbarButtonDisabled" href="#" id="ASSOCCOMPARELINK">
<img src="images/compare_records_16x16.gif">
<span id="ASSOClinkCompareText">compare</span>
</a>
</DIV>
</TD>
<TD>
<img src="images/my_custom_picture.gif" alt="CustomPicture" height="16" width="16" />
<input type="checkbox" id="CBValue" name="Label" value="MyLabel">
</TD>
</TR>
Add an extra picture / checkbox. Note, you will probably have to change this around until you are content with the look-and-feel. You will also need to create a custom gif image (roadworks GIF attached as my_custom_picture.gif - resize using paint.exe if need be). Place
this file in the directory $CUST_DEVROOT/com/tibco/mdm/ui/workflow/engine/workitem/images.
8). Edit the $MQ_COMMON_DIR/standard/forms/fm26ca_mod.xml XML form. Add a new field "CBValue"extra input or output parameters
<Field>
<ID>CBValue</ID>
<InputFrom/>
<OutputTo>(//Form/Field/ID[text()='CBValue'])/following-sibling::Value</OutputTo>
<OutputTo/>
<Value/>
</Field>
(Note, you are copying the CBValue field from the HTML form to the output field /Form/Field/ID[tex()='CBValue']/Value). After this, you will need to go through the XMLC build process to change the html template into a java class :
9). Change directory to $MQ_HOME/build/custom and execute the following command:
ant -verbose compile
The class files are created in the $CUST_DEVROOT/classes/servletclasses/WEB-INF/com/tibco/mdm/ui/workflow/engine/workitem/templates directory
10). Having initially compiled the XMLC classes, execute the following command:
ant -verbose deployCustom
11). You now need to copy the replacement into the ECMClasses.jar file inside the ECM.ear, replacing the original class. To do this safely, create a temporary directory under your home or login directory:
mkdir ~/temp (~ is shorthand for your home or login directory, and can be sued direct in Linux / Unix. In windows, replace with your login directory path)
Change directory to ~/temp
Copy the deployed ECM.ear file from the server (for JBOSS, $JBOSS_HOME/server/<<CIM_Server>>/deploy/ECM.ear) to ~/temp
jar -xvf ECM.ear ECMClasses.jar
Copy the workflow subdirectory tree and file com/tibco/mdm/ui/workflow/engine/workitem/templates/ProductEditApproval.class
from $MQ_HOME/build/custom/ to ~/temp
12). Roll-up the repalcement file into ECM.ear.
jar -uvf ECMClasses.jar com/tibco/mdm/ui/workflow/engine/workitem/templates/ProductEditApproval.class
jar -uvf ECM.ear ECMClasses.jar
13). Put the gif image into the ECM.ear file.
Copy the gif image from $CUST_DEVROOT/com/tibco/mdm/ui/workflow/engine/workitem/images to ~/temp/images
jar -xvf ECM.ear EML.war
jar -uvf EML.war images/my_custom_picture.gif
jar -uvf ECM.ear EML.war
14). Change the workflow product edit workflow (probably standard/workflow/wfin26producteditapprovalv3.xml), adding the parameter:
<Parameter direction="in" eval="constant" type="string" name="Form">standard/forms/fm26ca_mod.xml</Parameter>
to the activity:
<Activity Name="InternalApprovalWorkItemModify">
<Action>CreateWorkItem</Action>
<Description lang="en">Create workitem for approval of the modification of record</Description>
<Execution>SYNCHR</Execution>
<Parameter direction="in" eval="constant" type="string" name="Intent">Approval</Parameter>
<Parameter direction="in" eval="constant" type="string" name="CUSTOM_HITHERE">DEC1</Parameter>
<Parameter direction="in" eval="constant" type="string" name="CUSTOM_HITHERE2">DEC2</Parameter>
<Parameter direction="in" eval="constant" type="string" name="RecordAttributeName">GTIN</Parameter>
<Parameter direction="in" eval="constant" type="string" name="RecordAttributeName1">SHORTDESC</Parameter>
<Parameter direction="in" eval="constant" type="string" name="RecordAttributeName2">UOM</Parameter>
<Parameter direction="in" eval="constant" type="string" name="RecordAttributeName3">DEC1</Parameter>
<Parameter direction="in" eval="rule" source="Record Edit Approval" type="long" name="ParticipantID">workDoc</Parameter>
<Parameter direction="in" eval="constant" type="string" name="FormPresentation">com.tibco.mdm.ui.workflow.engine.workitem.templates.ProductEditApproval</Parameter>
<Parameter direction="in" eval="constant" type="string" name="TaskType">CATALOGMESSAGE</Parameter>
<Parameter direction="in" eval="variable" type="document" name="InDocument">workDoc</Parameter>
<Parameter direction="out" eval="variable" type="document" name="OutDocument">wiDoc</Parameter>
<Parameter direction="out" eval="variable" type="boolean" name="WorkItemCreated">approvalFlag</Parameter>
<Parameter direction="out" eval="variable" type="boolean" name="MergedDocument">workDoc</Parameter>
<Parameter direction="out" name="StepID" eval="variable" type="long">pl1</Parameter>
<Parameter direction="in" eval="constant" type="string" name="ExpiryType">RELATIVE</Parameter>
<Parameter direction="in" eval="constant" type="string" name="ExpiryDate">1:0:0:0</Parameter>
</Activity>
And an extra conditional transition afterwards that tests the new CBValue form value from the OutDocument (or, possibly, MergedDocument):
<Transition FromActivity="InternalApprovalWorkItemModify" ToActivity="...">
<Description>Check CBValue Parameter</Description>
<Rule>
<Parameter name="cBValue" type="string" eval="xpath" source="/Form/field/ID[text()='CBValue'/Value]" direction="in">OutDocument</Parameter>
<Parameter name="result" type="boolean" direction="out"/>
<Condition format="bsh"><![CDATA[result = (cBValue.equalsIgnoreCase('true'));]]></Condition>
</Rule>
</Transition>
(note - not sure about the condition: you would need to inspect the OutDocument in the EventLog and see what the value of
/Form/field/ID[text()='CBValue'/Value actually is)
15). Finally, stop, replace, and restart ECM.ear:
cp $JBOSS_HOME/server/<<CIM_Server>>/deploy/ECM.ear $JBOSS_HOME/server/<<CIM_Server>>/ECM.ear.old (that is, save the "old" ECM.ear for backing out if you need to)
stop CIM (if you haven't yet)
cp -f ~/temp/ECM.ear $JBOSS_HOME/server/<<CIM_Server>>/deploy/ECM.ear
restart CIM.
Your Product Modify process should now, via a user's Inbox, provide an extra checkbox for the user that will be examined in the
/wfin26producteditapprovalv3.xml workflow. By changing the form line you added from:
<input type="checkbox" id="CBValue" name="Label" value="MyLabel">
To
<input type="radio" id="CBValue" name="Label" value="MyLabel">
You can change the checkbox to a radio button, while adding "checked", as in
<input type="checkbox" id="CBValue" name="Label" value="MyLabel" checked="checked">
The checkbox / button appears pre-selected and has to be clicked to be unselected.
Issue/Introduction
Method for creating a check box on the ProductEditApproval work item page and subsequently handling the output from the checkbox after the work item page is submitted back to the workflow that initiated the work item.