Hi, I was trying to use my own objects in order to call Kaltura APIs. The objects I used looks something like that (I removed most of the implementation to simplify the question):
public class KalturaCaptionAssetFilter { public String entryIdEqual; }
public class KalturaCaptionAssetListResponse { public ArrayList<KalturaCaptionAsset> objects; public int totalCount = Integer.MIN_VALUE; }
I set the input using: <scriptTask id="setVars" name="Set Variables" scriptFormat="javascript"> <script><![CDATA[ importPackage(com.kaltura.client.types); var captionAssetFilter = new com.kaltura.client.types.KalturaCaptionAssetFilter(); captionAssetFilter.entryIdEqual = entryId; execution.setVariable("captionAssetFilter", captionAssetFilter); ]]></script> </scriptTask>
And I call the API using sub-process: <callActivity id="captionAsset.list" name="captionAsset.list" calledElement="kaltura-captionAsset-list"> <extensionElements> <activiti:in source="captionAssetFilter" target="filter"/> <activitiut source="response" target="captionAssets"/> </extensionElements> </callActivity>
Later in the process I check the returned response: <sequenceFlow id="flow12" name="Yes" sourceRef="captionsFound" targetRef="setTranscriptAlignment"> <conditionExpression xsi:type="tFormalExpression"> <![CDATA[${captionAssets.totalCount > 0}]]> </conditionExpression> </sequenceFlow>
1. Some of our customers might want to use this process in other BPMN engines, is there a non-extension way to implement the inputs and outputs? 2. The call to the API works perfect, meaning the objects passed fine into the sub-process, but the response object is probably not returned right as I get the following exception: 03:48:55,189 [http-bio-8080-exec-8] ERROR org.activiti.engine.impl.pvm.runtime.AtomicOperationProcessEnd - Error while completing sub process of execution ProcessInstance[10242] org.activiti.engine.ActivitiException: Unknown property used in expression: ${captionAssets.totalCount > 0} at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:53) … Caused by: org.activiti.engine.impl.javax.el.PropertyNotFoundException: Could not find property totalCount in class com.kaltura.client.types.KalturaCaptionAssetListResponse at org.activiti.engine.impl.javax.el.BeanELResolver.toBeanProperty(BeanELResolver.java:627) …
03:48:55,208 [http-bio-8080-exec-8] ERROR org.activiti.engine.impl.pvm.runtime.AtomicOperationProcessEnd - Error while completing sub process of execution ProcessInstance[10214] org.activiti.engine.ActivitiException: Unknown property used in expression: ${captionAssets.totalCount > 0} at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:53) … Caused by: org.activiti.engine.impl.javax.el.PropertyNotFoundException: Could not find property totalCount in class com.kaltura.client.types.KalturaCaptionAssetListResponse at org.activiti.engine.impl.javax.el.BeanELResolver.toBeanProperty(BeanELResolver.java:627) …
I thought that changing my API object to JPA objects will help, but it's a lot of work so I'm asking before I get into it, also I would like to know if I should add something to the processEngineConfiguration configuration as well.
I think the forum swallowed some of your code … and it's hard to understand what you are doing. So could you add those?
Do you store the variables as Java serializable? If so, why doesn't the KalturaCaptionAssetListResponse have a totalCount field? Is the correct class on the Activiti classpath?
Sorry, here it is again: Hi, I was trying to use my own objects in order to call Kaltura APIs. The objects I used looks something like that (I removed most of the implementation to simplify the question): <java> public class KalturaCaptionAssetFilter { public String entryIdEqual; }
public class KalturaCaptionAssetListResponse { public ArrayList<KalturaCaptionAsset> objects; public int totalCount = Integer.MIN_VALUE; } </java>
I set the input using: <code> <scriptTask id="setVars" name="Set Variables" scriptFormat="javascript"> <script><![CDATA[ importPackage(com.kaltura.client.types); var captionAssetFilter = new com.kaltura.client.types.KalturaCaptionAssetFilter(); captionAssetFilter.entryIdEqual = entryId; execution.setVariable("captionAssetFilter", captionAssetFilter); ]]></script> </scriptTask> </code>
And I call the API using sub-process: <code> <callActivity id="captionAsset.list" name="captionAsset.list" calledElement="kaltura-captionAsset-list"> <extensionElements> <activiti:in source="captionAssetFilter" target="filter"/> <activitiut source="response" target="captionAssets"/> </extensionElements> </callActivity> </code> Later in the process I check the returned response: <code> <sequenceFlow id="flow12" name="Yes" sourceRef="captionsFound" targetRef="setTranscriptAlignment"> <conditionExpression xsi:type="tFormalExpression"> <![CDATA[${captionAssets.totalCount > 0}]]> </conditionExpression> </sequenceFlow> </code>
1. Some of our customers might want to use this process in other BPMN engines, is there a non-extension way to implement the inputs and outputs? 2. The call to the API works perfect, meaning the objects passed fine into the sub-process, but the response object is probably not returned right as I get the following exception:<blockcode> 03:48:55,189 [http-bio-8080-exec-8] ERROR org.activiti.engine.impl.pvm.runtime.AtomicOperationProcessEnd - Error while completing sub process of execution ProcessInstance[10242] org.activiti.engine.ActivitiException: Unknown property used in expression: ${captionAssets.totalCount > 0} at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:53) … Caused by: org.activiti.engine.impl.javax.el.PropertyNotFoundException: Could not find property totalCount in class com.kaltura.client.types.KalturaCaptionAssetListResponse at org.activiti.engine.impl.javax.el.BeanELResolver.toBeanProperty(BeanELResolver.java:627) …
03:48:55,208 [http-bio-8080-exec-8] ERROR org.activiti.engine.impl.pvm.runtime.AtomicOperationProcessEnd - Error while completing sub process of execution ProcessInstance[10214] org.activiti.engine.ActivitiException: Unknown property used in expression: ${captionAssets.totalCount > 0} at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:53) … Caused by: org.activiti.engine.impl.javax.el.PropertyNotFoundException: Could not find property totalCount in class com.kaltura.client.types.KalturaCaptionAssetListResponse at org.activiti.engine.impl.javax.el.BeanELResolver.toBeanProperty(BeanELResolver.java:627) …</blockcode>
I thought that changing my API object to JPA objects will help, but it's a lot of work so I'm asking before I get into it, also I would like to know if I should add something to the processEngineConfiguration configuration as well.
1. No. BPMN 2.0 does have a variable mapping, but it's XML based and not compatible with Activiti
2. No, changing to JPA will not solve the problem. Can you see the variable in the ACT_RU_VARIABLE table? if not, it's not set and you must set it explicitely.