feat(rules): add DataStore rules

Related to #345
This commit is contained in:
Nico Rehwaldt 2016-01-25 21:25:30 +01:00 committed by pedesen
parent cc2cf3f561
commit 4f28d14cbc
3 changed files with 128 additions and 31 deletions

View File

@ -619,12 +619,12 @@ function canConnectSequenceFlow(source, target) {
function canConnectDataAssociation(source, target) {
if (is(source, 'bpmn:DataObjectReference') &&
if (isAny(source, [ 'bpmn:DataObjectReference', 'bpmn:DataStoreReference' ]) &&
isAny(target, [ 'bpmn:Activity', 'bpmn:ThrowEvent' ])) {
return { type: 'bpmn:DataInputAssociation' };
}
if (is(target, 'bpmn:DataObjectReference') &&
if (isAny(target, [ 'bpmn:DataObjectReference', 'bpmn:DataStoreReference' ]) &&
isAny(source, [ 'bpmn:Activity', 'bpmn:CatchEvent' ])) {
return { type: 'bpmn:DataOutputAssociation' };
}

View File

@ -1,78 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:bpmn2="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:xsi="http://www.w3.org/2001/XMLSchema-instance" id="_biH3sOTeEeS2YerRfpjPrw" targetNamespace="http://activiti.org/bpmn" exporter="camunda modeler" exporterVersion="2.6.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_biH3sOTeEeS2YerRfpjPrw" exporter="camunda modeler" exporterVersion="2.6.0" targetNamespace="http://activiti.org/bpmn">
<bpmn2:process id="Process" isExecutable="false">
<bpmn2:startEvent id="StartEvent_None" />
<bpmn2:startEvent id="StartEvent_None"/>
<bpmn2:subProcess id="EventSubProcess" triggeredByEvent="true">
<bpmn2:startEvent id="StartEvent_Message_in_EventSubProcess">
<bpmn2:messageEventDefinition id="MessageEventDefinition_1" />
<bpmn2:messageEventDefinition id="MessageEventDefinition_1"/>
</bpmn2:startEvent>
</bpmn2:subProcess>
<bpmn2:task id="Task" />
<bpmn2:task id="Task"/>
<bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_Link">
<bpmn2:linkEventDefinition id="_LinkEventDefinition_2" />
<bpmn2:linkEventDefinition id="_LinkEventDefinition_2"/>
</bpmn2:intermediateThrowEvent>
<bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_Link">
<bpmn2:linkEventDefinition id="_LinkEventDefinition_3" />
<bpmn2:linkEventDefinition id="_LinkEventDefinition_3"/>
</bpmn2:intermediateCatchEvent>
<bpmn2:subProcess id="SubProcess">
<bpmn2:endEvent id="EndEvent_in_SubProcess" />
<bpmn2:endEvent id="EndEvent_in_SubProcess"/>
</bpmn2:subProcess>
<bpmn2:endEvent id="EndEvent_None" />
<bpmn2:dataObjectReference id="DataObjectReference" dataObjectRef="DataObject" />
<bpmn2:dataObject id="DataObject" />
<bpmn2:textAnnotation id="TextAnnotation" />
<bpmn2:endEvent id="EndEvent_None"/>
<bpmn2:dataObjectReference id="DataObjectReference" dataObjectRef="DataObject"/>
<bpmn2:dataObject id="DataObject"/>
<bpmn2:dataStoreReference id="DataStoreReference" name="" dataStoreRef="DataStore_1"/>
<bpmn2:textAnnotation id="TextAnnotation"/>
</bpmn2:process>
<bpmn2:dataStore id="DataStore_1" name="Data Store 1"/>
<bpmndi:BPMNDiagram id="_BPMNDiagram_2">
<bpmndi:BPMNPlane id="_BPMNPlane_2" bpmnElement="Process">
<bpmndi:BPMNShape id="_BPMNShape_Task_8" bpmnElement="Task">
<dc:Bounds x="172" y="147" width="100" height="80" />
<dc:Bounds height="80.0" width="100.0" x="172.0" y="147.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_4" bpmnElement="StartEvent_None">
<dc:Bounds x="65" y="169" width="36" height="36" />
<dc:Bounds height="36.0" width="36.0" x="65.0" y="169.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds x="83" y="210" width="0" height="0" />
<dc:Bounds height="0.0" width="0.0" x="83.0" y="210.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_SubProcess_4" bpmnElement="EventSubProcess" isExpanded="true">
<dc:Bounds x="132" y="360" width="313" height="169" />
<dc:Bounds height="169.0" width="313.0" x="132.0" y="360.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_5" bpmnElement="StartEvent_Message_in_EventSubProcess">
<dc:Bounds x="171" y="419" width="36" height="36" />
<dc:Bounds height="36.0" width="36.0" x="171.0" y="419.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds x="189" y="460" width="0" height="0" />
<dc:Bounds height="0.0" width="0.0" x="189.0" y="460.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_IntermediateCatchEvent_3" bpmnElement="IntermediateThrowEvent_Link">
<dc:Bounds x="336" y="168" width="36" height="36" />
<dc:Bounds height="36.0" width="36.0" x="336.0" y="168.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds x="354" y="209" width="0" height="0" />
<dc:Bounds height="0.0" width="0.0" x="354.0" y="209.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_IntermediateThrowEvent_2" bpmnElement="IntermediateCatchEvent_Link">
<dc:Bounds x="425" y="168" width="36" height="36" />
<dc:Bounds height="36.0" width="36.0" x="425.0" y="168.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds x="443" y="209" width="0" height="0" />
<dc:Bounds height="0.0" width="0.0" x="443.0" y="209.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_SubProcess_5" bpmnElement="SubProcess" isExpanded="true">
<dc:Bounds x="516" y="360" width="205" height="169" />
<dc:Bounds height="169.0" width="205.0" x="516.0" y="360.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_TextAnnotation_2" bpmnElement="TextAnnotation">
<dc:Bounds x="576" y="36" width="85" height="85" />
<dc:Bounds height="85.0" width="85.0" x="576.0" y="36.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_EndEvent_5" bpmnElement="EndEvent_in_SubProcess">
<dc:Bounds x="639" y="451" width="36" height="36" />
<dc:Bounds height="36.0" width="36.0" x="639.0" y="451.0"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_EndEvent_6" bpmnElement="EndEvent_None">
<dc:Bounds x="516" y="168" width="36" height="36" />
<dc:Bounds height="36.0" width="36.0" x="516.0" y="168.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds x="534" y="209" width="0" height="0" />
<dc:Bounds height="0.0" width="0.0" x="534.0" y="209.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="DataObjectReference_di" bpmnElement="DataObjectReference">
<dc:Bounds x="601" y="162" width="36" height="50" />
<dc:Bounds height="50.0" width="36.0" x="601.0" y="162.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds x="574" y="212" width="90" height="20" />
<dc:Bounds height="20.0" width="90.0" x="574.0" y="212.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_DataStoreReference_2" bpmnElement="DataStoreReference">
<dc:Bounds height="50.0" width="50.0" x="671.0" y="161.0"/>
<bpmndi:BPMNLabel>
<dc:Bounds height="21.0" width="79.0" x="657.0" y="216.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>

View File

@ -188,6 +188,95 @@ describe('features/modeling/rules - BpmnRules', function() {
dataAssociation: { type: 'bpmn:DataInputAssociation' }
});
}));
it('connect DataStoreReference -> StartEvent_None', inject(function() {
expectCanConnect('DataStoreReference', 'StartEvent_None', {
sequenceFlow: false,
messageFlow: false,
association: true,
dataAssociation: false
});
}));
it('connect StartEvent_None -> DataStoreReference', inject(function() {
expectCanConnect('StartEvent_None', 'DataStoreReference', {
sequenceFlow: false,
messageFlow: false,
association: true,
dataAssociation: { type: 'bpmn:DataOutputAssociation' }
});
}));
it('connect DataStoreReference -> EndEvent_None', inject(function() {
expectCanConnect('DataStoreReference', 'EndEvent_None', {
sequenceFlow: false,
messageFlow: false,
association: true,
dataAssociation: { type: 'bpmn:DataInputAssociation' }
});
}));
it('connect EndEvent_None -> DataStoreReference', inject(function() {
expectCanConnect('EndEvent_None', 'DataStoreReference', {
sequenceFlow: false,
messageFlow: false,
association: true,
dataAssociation: false
});
}));
it('connect Task -> DataStoreReference', inject(function() {
expectCanConnect('Task', 'DataStoreReference', {
sequenceFlow: false,
messageFlow: false,
association: true,
dataAssociation: { type: 'bpmn:DataOutputAssociation' }
});
}));
it('connect DataStoreReference -> Task', inject(function() {
expectCanConnect('DataStoreReference', 'Task', {
sequenceFlow: false,
messageFlow: false,
association: true,
dataAssociation: { type: 'bpmn:DataInputAssociation' }
});
}));
it('connect SubProcess -> DataStoreReference', inject(function() {
expectCanConnect('SubProcess', 'DataStoreReference', {
sequenceFlow: false,
messageFlow: false,
association: true,
dataAssociation: { type: 'bpmn:DataOutputAssociation' }
});
}));
it('connect DataStoreReference -> SubProcess', inject(function() {
expectCanConnect('DataStoreReference', 'SubProcess', {
sequenceFlow: false,
messageFlow: false,
association: true,
dataAssociation: { type: 'bpmn:DataInputAssociation' }
});
}));
});