cancel
Showing results for 
Search instead for 
Did you mean: 

Read private dataInputAssociations from CallActivityBehaviour

artur
Champ in-the-making
Champ in-the-making
Hi,

Have experience to share.
My issue was to read data input asscoiations on call activity from deployed process definition.
For now Activity API dosen't allow to access such info directly. There is a way to do that using reflection.
Code below shows how to use reflection to access data input associations.

//is it call activity task?
                       if ("callActivity".equals(activiti.getProperty("type"))) {
                        CallActivityBehavior callactivityBehavior = (CallActivityBehavior) activiti.getActivityBehavior();
                        …
// if calling 'SendSignal' process
      if (!"SendSignal".equals(callactivityBehavior.getProcessDefinitonKey())) {
          try {
//use reflection to read private field dataInputAssociations
         privDataInputAssociationsField = CallActivityBehavior.class.getDeclaredField("dataInputAssociations");
         privDataInputAssociationsField.setAccessible(true);
         dataInputAssociations = (List<AbstractDataAssociation>) privDataInputAssociationsField.get(callactivityBehavior);

         for (AbstractDataAssociation data : dataInputAssociations) {
// is it 'taskId' input parameter?
             if ("taskId".equals(data.getTarget())) {
                HashMap<String, Object> values = new HashMap();
// remember idTask and its value
                values.put("IDTask", idTask);
                values.put("IDPreviousTask", data.getSourceExpression().getExpressionText());




Remember it works according local JVM security settings.
Hope is usefull for someone who faceses same problem.

Best regards,
Artur
1 REPLY 1

jbarrez
Star Contributor
Star Contributor
thanks for sharing that.

Wouldn't it be better if those properties are exposed with getters in the BpmnModel?
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.