cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in getting Bean Object in JavaDelegate

sarkar92
Champ in-the-making
Champ in-the-making
We are using restful api to access Activiti Process as webservices.
We are sending parameters (including objects) to workflow serviceTask.
But when we try to retrieve the object in JavaDelegate using "execution.getVariable("objectName")" ,its return String object byDefault which cannot be cast to specific bean object which it belongs.

the exception —–>

 java.lang.ClassCastException: java.lang.String cannot be cast to net.simplyfiIT.dto.UserBean

here how I send parameters to the workflow——–>

 param.put("processDefinitionId", processDefinitionId);
             param.put("beanObject",user);
             param.put("screenName", screenName);
             param.put("action","Initiate Create User");
             param.put("object", object);
            
         //Call activiti api
            processInstanceId=HandleActivitiProcess.startRequestedProcess(param);
            

here how I get variable in JavaDelegate——>

Object obj =  execution.getVariable("beanObject");  //this is the object
        String scName = (String) execution.getVariable("screenName");
5 REPLIES 5

sarkar92
Champ in-the-making
Champ in-the-making
how can I get the Original object in JavaDelegate???


Please help

trademak
Star Contributor
Star Contributor
Hi,

execution.getVariable("object") call is right.
But the issue is that you can't sent Java objects to the REST API. It only accepts primitives, String and Dates.

Best regards,

sarkar92
Champ in-the-making
Champ in-the-making
what about sending List or Array in REST API

trademak
Star Contributor
Star Contributor
Hi,

You mean a list of Strings for example? That's not implemented right now, but that's easy to add.
Let me know if that's what you are looking for.

Best regards,

sarkar92
Champ in-the-making
Champ in-the-making
hi ,
thanks for your reply.

Yes right now I am looking for sending list or array to the workflow..