Clarity

  • 1.  Calling Java based job using parameters from GEL script

    Posted Oct 09, 2013 06:00 AM
    Can we call java based jobs from GEL script? For e.g. I want to call 'Update Allocation From Estimates' job from GEL script with in a process. This is java based job.
    If we can call it from GEL script, how can we pass required parameters to it?


  • 2.  Moving to the XOG/WSDL/GEL Board

     
    Posted Oct 14, 2013 05:52 PM
    Moving to XOG/WSDL/GEL Board


  • 3.  RE: Calling Java based job using parameters from GEL script

     
    Posted Oct 14, 2013 05:58 PM
    Hi all,

    Any ideas here for this one?

    Thanks!
    Chris

    skdharma wrote:

    Can we call java based jobs from GEL script? For e.g. I want to call 'Update Allocation From Estimates' job from GEL script with in a process. This is java based job.
    If we can call it from GEL script, how can we pass required parameters to it?


  • 4.  RE: Calling Java based job using parameters from GEL script

    Posted Oct 15, 2013 05:53 AM
    The two previous posts have not registered, so apologies if they reappear.

    It is possible to invoke Java classes from GEL.

    Here is a way to do it:

    <core:new var=”String” className=”String” classLoader=”classLoader” useContextClassLoader=”boolean” trim=”boolean” escapeText=”boolean”/>

    className specifies the class to instantiate

    classLoader defines the class loader to use when instantiating the classmethod specifies which method to invoke

    useContextClassLoader states whether to use the Context ClassLoader to resolve/load classes

    <core:invoke var=”String” method=”String” on=”Object” exceptionVar=”String” trim=”boolean” escapeText=”boolean”/>

    method specifies the method to invoke on the instantiated by <core:new>

    on specifies which object to invoke the method on

    exceptionVar returns any exception thrown by the tag

    <core:invokeStatic var=”String” method=”String” on=”Object” exceptionVar=”String” trim=”boolean” escapeText=”boolean”/>

    method specifies the method to invoke on the instantiated by <core:new>

    on specifies which object to invoke the method on

    exceptionVar returns any exception thrown by the tag


    The <core:new> tag instantiates a class and the <core:invoke> tag invokes methods on the resulting object, using any parameters supplied by the <core:arg> tag(s).

    In the following example a new instance of the XOGClientInterface class is created, the “invoke” method is then invoked to supply log in credentials and execute the XML script given:

    <core:new className="com.niku.xog.client.XOGClientInterface" var="xogcaller"/>

    <core:invoke method="invoke" on="${xogcaller}" var="xogresponse">

    <core:arg type="java.lang.String" value="admin"/>

    <core:arg type="org.w3c.dom.Document" value="${xmlScript}"/>
    </core:invoke>

    <gel:log level="INFO"> <gel:expr select="$xogresponse/"/></gel:log>


    In your case you'll need to use the job's Java class, and you'll need to dig a bit to work out the necessary parameter types.

    Good luck!

    Paul


  • 5.  RE: Calling Java based job using parameters from GEL script

    Posted Dec 06, 2013 11:46 AM

    Thanks for the possible solutions and this is WHAT I am desperately seeking for it. We need to write a gel script to call the java based job Synchronize portfolio investments. But I ran into the problem:

    org.apache.commons.jelly.JellyTagException: null:13:66: <core:invoke> No such accessible method: invoke() on object: com.ca.clarity.pfm.job.PortfolioSyncJob
    
    at org.apache.commons.jelly.tags.core.InvokeTag.doTag(InvokeTag.java:100)
    
    at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:247)
    
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
    
    at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:186)
    
    at com.niku.union.gel.tags.ScriptTag.doTag(ScriptTag.java:20)
    
    at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:247)
    
    at com.niku.union.gel.GELScript.run(GELScript.java:48)
    
    at com.niku.union.gel.GELController.invoke(GELController.java:23)
    
    at com.niku.bpm.services.ExecuteCustomAction.run(ExecuteCustomAction.java:195)
    
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    
    at java.lang.Thread.run(Thread.java:722)
    Caused by: java.lang.NoSuchMethodException: No such accessible method: invoke() on object: com.ca.clarity.pfm.job.PortfolioSyncJob
    
    at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:214)
    
    at org.apache.commons.jelly.tags.core.InvokeTag.doTag(InvokeTag.java:97)
    
    ... 11 more
    Root cause
    java.lang.NoSuchMethodException: No such accessible method: invoke() on object: com.ca.clarity.pfm.job.PortfolioSyncJob
    
    at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:214)
    
    at org.apache.commons.jelly.tags.core.InvokeTag.doTag(InvokeTag.java:97)
    
    at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:247)
    
    at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
    
    at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:186)
    
    at com.niku.union.gel.tags.ScriptTag.doTag(ScriptTag.java:20)
    
    at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:247)
    
    at com.niku.union.gel.GELScript.run(GELScript.java:48)
    
    at com.niku.union.gel.GELController.invoke(GELController.java:23)
    
    at com.niku.bpm.services.ExecuteCustomAction.run(ExecuteCustomAction.java:195)
    
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    
    at java.lang.Thread.run(Thread.java:722)
    

     

    The Gel script very simple just for the purpose of proof the concept.

    <gel:script xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
       xmlns:core="jelly:core" xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"
      xmlns:rem="jelly:com.niku.union.gel.RemedyTagLibrary"
      xmlns:soap="jelly:com.niku.union.gel.SOAPTagLibrary"
      xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:sql="jelly:sql" 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:new className="com.niku.xog.client.XOGClientInterface" var="xogcaller"/>

    <core:invoke method="invoke" on="${xogcaller}" var="xogresponse">
    </core:invoke>

    <gel:log level="INFO"> <gel:expr select="$xogresponse/"/></gel:log>

    </gel:script>

    Please advise what could be wrong?

    Thanks