2016-10-05 10 views
0

私は、2つの入力パラメータ、1つの出力パラメータを受け入れ、1つのフォームデータフィールドを定義したプロセス変数とヒューマンタスクを設定するスクリプトタスクのみを持つ単純なbpmnを持っています。REST APIを使用してCamundaのヒューマンタスクのフォーム変数のみを取得する方法は?

処理を開始すると、実行はヒューマンタスクで停止します。私はヒューマンタスクフォームの変数(すなわち、入力変数および/またはフォームデータフィールドが、スクリーンタスクによって設定された実行変数ではない)を取得しようとしています。次のようにREST APIを照会する

結果は、次のとおり

  • タスク/ ID /変数 - 入力変数、スクリプトタスク変数
  • タスク/ ID /フォーム変数 - 入力変数、フォームデータフィールドとスクリプトタスク変数
  • タスク/ ID/localVariables - 空

スクリプトタスク変数は、他のフォームの変数と一緒に返された理由を私は理解できません。

入力変数とフォームデータフィールドのみ取得できますが、画面タスク変数(および場合によっては他のすべてのプロセス変数)は取得できませんか? 編集:私は変数名を選択するクエリパラメータを使用したくないです。

私はCamunda Widlfly 10.0.0を使用しています。

BPMN私が使用している:

<?xml version="1.0" encoding="UTF-8"?> 
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.3.0"> 
    <bpmn:process id="userTaskExample" isExecutable="true"> 
    <bpmn:startEvent id="StartEvent_02mu30n"> 
     <bpmn:outgoing>SequenceFlow_14v3dyf</bpmn:outgoing> 
    </bpmn:startEvent> 
    <bpmn:endEvent id="EndEvent_144sl4n"> 
     <bpmn:incoming>SequenceFlow_0acu0wh</bpmn:incoming> 
    </bpmn:endEvent> 
    <bpmn:sequenceFlow id="SequenceFlow_0acu0wh" sourceRef="Task_096f7n7" targetRef="EndEvent_144sl4n" /> 
    <bpmn:userTask id="Task_096f7n7" name="user task sk"> 
     <bpmn:extensionElements> 
     <camunda:formData> 
      <camunda:formField id="form_1" label="form_1" type="string" defaultValue="form_1_" /> 
     </camunda:formData> 
     <camunda:inputOutput> 
      <camunda:inputParameter name="input_1">input_1_val</camunda:inputParameter> 
      <camunda:inputParameter name="input_2">input_2_val</camunda:inputParameter> 
      <camunda:outputParameter name="output_1">output_2</camunda:outputParameter> 
     </camunda:inputOutput> 
     </bpmn:extensionElements> 
     <bpmn:incoming>SequenceFlow_0sulfwg</bpmn:incoming> 
     <bpmn:outgoing>SequenceFlow_0acu0wh</bpmn:outgoing> 
    </bpmn:userTask> 
    <bpmn:sequenceFlow id="SequenceFlow_14v3dyf" sourceRef="StartEvent_02mu30n" targetRef="Task_0cphzp1" /> 
    <bpmn:sequenceFlow id="SequenceFlow_0sulfwg" sourceRef="Task_0cphzp1" targetRef="Task_096f7n7" /> 
    <bpmn:scriptTask id="Task_0cphzp1" name="script task sk" scriptFormat="groovy" camunda:resultVariable="script_task_variable"> 
     <bpmn:incoming>SequenceFlow_14v3dyf</bpmn:incoming> 
     <bpmn:outgoing>SequenceFlow_0sulfwg</bpmn:outgoing> 
     <bpmn:script><![CDATA["scipt task variable"]]></bpmn:script> 
    </bpmn:scriptTask> 
    </bpmn:process> 
    <bpmndi:BPMNDiagram id="BPMNDiagram_1"> 
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="userTaskExample"> 
     <bpmndi:BPMNShape id="StartEvent_02mu30n_di" bpmnElement="StartEvent_02mu30n"> 
     <dc:Bounds x="151" y="66" width="36" height="36" /> 
     <bpmndi:BPMNLabel> 
      <dc:Bounds x="169" y="102" width="0" height="0" /> 
     </bpmndi:BPMNLabel> 
     </bpmndi:BPMNShape> 
     <bpmndi:BPMNShape id="EndEvent_144sl4n_di" bpmnElement="EndEvent_144sl4n"> 
     <dc:Bounds x="616" y="66" width="36" height="36" /> 
     <bpmndi:BPMNLabel> 
      <dc:Bounds x="634" y="102" width="0" height="0" /> 
     </bpmndi:BPMNLabel> 
     </bpmndi:BPMNShape> 
     <bpmndi:BPMNEdge id="SequenceFlow_0acu0wh_di" bpmnElement="SequenceFlow_0acu0wh"> 
     <di:waypoint xsi:type="dc:Point" x="433" y="84" /> 
     <di:waypoint xsi:type="dc:Point" x="524" y="84" /> 
     <di:waypoint xsi:type="dc:Point" x="524" y="84" /> 
     <di:waypoint xsi:type="dc:Point" x="616" y="84" /> 
     <bpmndi:BPMNLabel> 
      <dc:Bounds x="539" y="84" width="0" height="0" /> 
     </bpmndi:BPMNLabel> 
     </bpmndi:BPMNEdge> 
     <bpmndi:BPMNShape id="UserTask_1lppvq8_di" bpmnElement="Task_096f7n7"> 
     <dc:Bounds x="333" y="44" width="100" height="80" /> 
     </bpmndi:BPMNShape> 
     <bpmndi:BPMNEdge id="SequenceFlow_14v3dyf_di" bpmnElement="SequenceFlow_14v3dyf"> 
     <di:waypoint xsi:type="dc:Point" x="169" y="102" /> 
     <di:waypoint xsi:type="dc:Point" x="169" y="133" /> 
     <di:waypoint xsi:type="dc:Point" x="252" y="133" /> 
     <di:waypoint xsi:type="dc:Point" x="192" y="204" /> 
     <di:waypoint xsi:type="dc:Point" x="275" y="204" /> 
     <di:waypoint xsi:type="dc:Point" x="275" y="284" /> 
     <bpmndi:BPMNLabel> 
      <dc:Bounds x="222" y="153.5" width="0" height="0" /> 
     </bpmndi:BPMNLabel> 
     </bpmndi:BPMNEdge> 
     <bpmndi:BPMNEdge id="SequenceFlow_0sulfwg_di" bpmnElement="SequenceFlow_0sulfwg"> 
     <di:waypoint xsi:type="dc:Point" x="325" y="331" /> 
     <di:waypoint xsi:type="dc:Point" x="401" y="342" /> 
     <di:waypoint xsi:type="dc:Point" x="383" y="204" /> 
     <di:waypoint xsi:type="dc:Point" x="383" y="124" /> 
     <bpmndi:BPMNLabel> 
      <dc:Bounds x="392" y="258" width="0" height="0" /> 
     </bpmndi:BPMNLabel> 
     </bpmndi:BPMNEdge> 
     <bpmndi:BPMNShape id="ScriptTask_1q3eqsu_di" bpmnElement="Task_0cphzp1"> 
     <dc:Bounds x="225" y="284" width="100" height="80" /> 
     </bpmndi:BPMNShape> 
    </bpmndi:BPMNPlane> 
    </bpmndi:BPMNDiagram> 
</bpmn:definitions> 

答えて

1

あなたの結果はあなたがヒューマン・タスク・フォームでのスクリプトタスクで定義された変数を表示している示唆しています。 あなたは私たちが見るフォーム変数取得するために、ソースを見たときので、私はこれを言う:私たちは私たちが気に変数名を取得するために、フォームフィールドの定義よりierate

// first, evaluate form fields 
TaskDefinition taskDefinition = task.getTaskDefinition(); 
if (taskDefinition != null) { 
    TaskFormData taskFormData = taskDefinition.getTaskFormHandler().createTaskForm(task); 
    for (FormField formField : taskFormData.getFormFields()) { 
    if(formVariableNames == null || formVariableNames.contains(formField.getId())) { 
     result.put(formField.getId(), createVariable(formField, task)); 
    } 
    } 
} 

// collect remaining variables from task scope and parent scopes 
task.collectVariables(result, formVariableNames, false, deserializeObjectValues); 

をお知らせし、その後、我々はからデータを取り込みます実行コンテキスト。

最終的にActiviti/Camunda(エンジンレベルで同じ90%)は、フォームに入力されたデータとスクリプトやサービスタスクで作成されたデータ(結果変数など)を区別しません。

何らかの理由でこれらを分ける必要がある場合は、命名規則と変数名規則に基づいたプロセス変数を照会することをお勧めします。

関連する問題