Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Process Manager (Stardust) » Retrieve Primitive Data instance value from Java code(Retrieving Primitive Data instance value from Java code using Stardust API)
Retrieve Primitive Data instance value from Java code [message #743045] Fri, 21 October 2011 04:17 Go to next message
Srinivasan Iyer is currently offline Srinivasan IyerFriend
Messages: 36
Registered: October 2011
Member
I need to get a Primitive Data instance value from Java code. I tried to use the WorkflowService but all its methods are related to activity and process instances.

How can I do for this?
Re: Retrieve Primitive Data instance value from Java code [message #743048 is a reply to message #743045] Fri, 21 October 2011 04:20 Go to previous messageGo to next message
Srinivasan Iyer is currently offline Srinivasan IyerFriend
Messages: 36
Registered: October 2011
Member
You can use the methods ...

 
getInDataPath(long processInstanceOID, String id)

Retrieves an IN data path on a Process Instance as specified in the corresponding process definition.
... or ...
 
getInDataPaths(long processInstanceOID, Set ids)

Retrieves multiple IN data paths from a Process Instance as specified in the corresponding process definition.

... on the WorkflowService, if you've defined IN data paths for the process data you want to read.

Please have a look at ...

Infinity Documentation > Developer Handbooks > The Modeling Guide > The Process Workbench > Working with Data Paths

... to see how to define data paths for a process definition.

If you want to evaluate IN data mappings from within your Java code, you need to use the methods ...
getInDataValue(long activityInstanceOID, String context, String id) 

Retrieves all evaluated IN data mappings that match the provided application context for the specified activity.

... respectively ...
getInDataValues(long activityInstanceOID, String context, Set ids) 


Retrieves all evaluated IN data mappings that match the provided application context for the specified activity.

Please have a look at the Infinity Process Platform API documentation to get more details about the usage of these methods ...

Infinity Documentation > Reference > Infintiy API > Engine API
Re: Retrieve Primitive Data instance value from Java code [message #743050 is a reply to message #743048] Fri, 21 October 2011 04:22 Go to previous messageGo to next message
Srinivasan Iyer is currently offline Srinivasan IyerFriend
Messages: 36
Registered: October 2011
Member
I already tested with this method and it throws an ObjectNotFoundException. As I understood, I use this method with the processInstanceID and the ID of the data in the arguments.

My data ID is "NextRole" as shown in the attached file. I used this java code:

Object obj = workflowservice.getInDataPath(processInstanceID, "NextRole");


Logs:
ag.carnot.error.ObjectNotFoundException: There is no data path with id 'NextRole'. at ag.carnot.workflow.runtime.beans.WorkflowServiceImpl.getInDataPath(WorkflowServiceImpl.java:524) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) 
Re: Retrieve Primitive Data instance value from Java code [message #743052 is a reply to message #743050] Fri, 21 October 2011 04:25 Go to previous message
Srinivasan Iyer is currently offline Srinivasan IyerFriend
Messages: 36
Registered: October 2011
Member
To evaluate IN / OUT data mappings you need to use the method below on the workflow service.

getInDataValue(long activityInstanceOID, String context, String id) 

The third parameter ID, is the ID of the IN data mapping you have specified for the activity. The data mappings that have been defined on a particular activity can be taken from the application context of the activity that belongs to the activity instance.

e.g.
Activity activity = activityInstance != null ? activityInstance.getActivity()  : null;
ApplicationContext applicationContext = activity.getApplicationContext("jsf");
List inDataMappings = applicationContext.getAllInDataMappings();

If you're using the getInDataValues method by passing null as third parameter, all IN data mappings for the context are retrieved.

getInDataValues(long activityInstanceOID, String context, Set ids)

If you just want to retrieve process data from outside the process, you need to use the getInDataPath or the getInDataPaths method on the Workflow service.
Previous Topic:carnotXaAuditTrailDataSource OracleXADataSource java.lang.InstantiationException
Next Topic:Process is not appearing as Startable process
Goto Forum:
  


Current Time: Tue Nov 25 22:30:59 GMT 2014

Powered by FUDForum. Page generated in 0.03089 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software