SupratikUBS

Java Job Run from Gel Script in CAPPM

Blog Post created by SupratikUBS on Dec 9, 2018

Sometimes we require to run a Java Job in CAPPM using a gel script where we can change the parameters of the job on run time.

 

This can be achieved by a small code snippet which runs the XBL Executor in Gel and passes the parameter to the job.

 

The code goes here:

 

<gel:script xmlns:core="jelly:core" xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary" xmlns:soap="jelly:com.niku.union.gel.SOAPTagLibrary"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope" xmlns:sql="jelly:sql" xmlns:util="jelly:util" xmlns:xog="http://www.niku.com/xog"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<core:catch var="excp">
<gel:parse var="inputDoc">
<data>

<!--job_name you can give any meaningful name and job_definition_id has to be the id of the job you want to run -->
<job job_name="Delete Process Instance-Supratik(Port Sync Java)" job_definition_id="50420" job_definition_type="JOB" recurrence_type="4" whenNow="1" whenRecur="1" />

<!-- Put the bind parameter code from the Job Definition pass the value in the similar format mentioned below-->
<param_process_name value="Portfolio Sync from Java"/>
</data>

 

</gel:parse>

 

<core:new className="com.niku.odf.object.xbl.XBLExecutor" var="xblInstance">
<core:arg value="scheduler/postSchedulerProperties.xbl"/>
<core:arg value="nmc"/>
<core:arg value="${inputDoc}"/>
</core:new> 
<core:invoke method="executeXBL" on="${xblInstance}" var="responseDoc"/>
<gel:log>Response Doc : <gel:expr select="$responseDoc"/> </gel:log>
</core:catch> 
</gel:script>

 

Thanks and Regards,

Supratik

 

Kindly comment if you find it useful.

Outcomes