Merge pull request #302 from sartography/320-add-default-for-file-data-get
Add default capability to file_data_get script
This commit is contained in:
commit
4780240103
|
@ -28,6 +28,8 @@ class FileDataGet(Script, DataStoreBase):
|
|||
def do_task(self, task, study_id, workflow_id, *args, **kwargs):
|
||||
if self.validate_kw_args(**kwargs):
|
||||
myargs = [kwargs['key']]
|
||||
if 'default' in kwargs.keys():
|
||||
myargs.append(kwargs['default'])
|
||||
|
||||
return self.get_data_common(None,
|
||||
None,
|
||||
|
|
|
@ -21,16 +21,21 @@ fileid = documents['UVACompl_PRCAppr'].files[0]['file_id']
|
|||
file_data_set(file_id=fileid,key='test',value='me')</bpmn:script>
|
||||
</bpmn:scriptTask>
|
||||
<bpmn:endEvent id="Event_1pdyoyv">
|
||||
<bpmn:incoming>Flow_15mmymi</bpmn:incoming>
|
||||
<bpmn:incoming>Flow_02bgcrp</bpmn:incoming>
|
||||
</bpmn:endEvent>
|
||||
<bpmn:sequenceFlow id="Flow_0z7kamo" sourceRef="Activity_0yikdu7" targetRef="Activity_19x6e2e" />
|
||||
<bpmn:sequenceFlow id="Flow_15mmymi" sourceRef="Activity_19x6e2e" targetRef="Event_1pdyoyv" />
|
||||
<bpmn:sequenceFlow id="Flow_15mmymi" sourceRef="Activity_19x6e2e" targetRef="Activity_0oaeqxs" />
|
||||
<bpmn:scriptTask id="Activity_19x6e2e" name="get output">
|
||||
<bpmn:incoming>Flow_0z7kamo</bpmn:incoming>
|
||||
<bpmn:outgoing>Flow_15mmymi</bpmn:outgoing>
|
||||
<bpmn:script>output=file_data_get(file_id=fileid,key='test')
|
||||
</bpmn:script>
|
||||
<bpmn:script>output=file_data_get(file_id=fileid,key='test')</bpmn:script>
|
||||
</bpmn:scriptTask>
|
||||
<bpmn:scriptTask id="Activity_0oaeqxs" name="get output2">
|
||||
<bpmn:incoming>Flow_15mmymi</bpmn:incoming>
|
||||
<bpmn:outgoing>Flow_02bgcrp</bpmn:outgoing>
|
||||
<bpmn:script>output2=file_data_get(file_id=fileid,key='unobtainium',default='nope')</bpmn:script>
|
||||
</bpmn:scriptTask>
|
||||
<bpmn:sequenceFlow id="Flow_02bgcrp" sourceRef="Activity_0oaeqxs" targetRef="Event_1pdyoyv" />
|
||||
</bpmn:process>
|
||||
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
|
||||
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_18biih5">
|
||||
|
@ -52,7 +57,7 @@ file_data_set(file_id=fileid,key='test',value='me')</bpmn:script>
|
|||
<dc:Bounds x="430" y="77" width="100" height="80" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="Event_1pdyoyv_di" bpmnElement="Event_1pdyoyv">
|
||||
<dc:Bounds x="782" y="99" width="36" height="36" />
|
||||
<dc:Bounds x="962" y="99" width="36" height="36" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNEdge id="Flow_0z7kamo_di" bpmnElement="Flow_0z7kamo">
|
||||
<di:waypoint x="530" y="117" />
|
||||
|
@ -60,11 +65,18 @@ file_data_set(file_id=fileid,key='test',value='me')</bpmn:script>
|
|||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge id="Flow_15mmymi_di" bpmnElement="Flow_15mmymi">
|
||||
<di:waypoint x="690" y="117" />
|
||||
<di:waypoint x="782" y="117" />
|
||||
<di:waypoint x="760" y="117" />
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNShape id="Activity_0ma7ela_di" bpmnElement="Activity_19x6e2e">
|
||||
<dc:Bounds x="590" y="77" width="100" height="80" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="Activity_0oaeqxs_di" bpmnElement="Activity_0oaeqxs">
|
||||
<dc:Bounds x="760" y="77" width="100" height="80" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNEdge id="Flow_02bgcrp_di" bpmnElement="Flow_02bgcrp">
|
||||
<di:waypoint x="860" y="117" />
|
||||
<di:waypoint x="962" y="117" />
|
||||
</bpmndi:BPMNEdge>
|
||||
</bpmndi:BPMNPlane>
|
||||
</bpmndi:BPMNDiagram>
|
||||
</bpmn:definitions>
|
||||
|
|
|
@ -27,5 +27,6 @@ class TestFileDatastore(BaseTest):
|
|||
processor = WorkflowProcessor(workflow)
|
||||
processor.do_engine_steps()
|
||||
task_data = processor.bpmn_workflow.last_task.data
|
||||
self.assertEqual(task_data['output'],'me')
|
||||
self.assertEqual(task_data['output'], 'me')
|
||||
self.assertEqual(task_data['output2'], 'nope')
|
||||
|
||||
|
|
Loading…
Reference in New Issue