AnsweredAssumed Answered

Using my own objects

Question asked by tan-tan on Jan 16, 2015
Latest reply on Jan 21, 2015 by jbarrez
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"/>
            <activiti:out 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.

Outcomes