Skip to content

Commit

Permalink
feat: add extension elements to activity
Browse files Browse the repository at this point in the history
  • Loading branch information
vicvolk committed Apr 27, 2023
1 parent 17c966a commit fa1d6c2
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .phpunit.result.cache

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions src/Impl/Instance/ActivityImpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
ActivityInterface,
DataInputAssociationInterface,
DataOutputAssociationInterface,
ExtensionElementsInterface,
FlowNodeInterface,
IoSpecificationInterface,
LoopCharacteristicsInterface,
Expand All @@ -30,6 +31,7 @@ abstract class ActivityImpl extends FlowNodeImpl implements ActivityInterface
protected static $dataOutputAssociationCollection;
protected static $resourceRoleCollection;
protected static $loopCharacteristicsChild;
protected static $extensionElementsChild;

public function __construct(ModelTypeInstanceContext $instanceContext)
{
Expand Down Expand Up @@ -89,6 +91,9 @@ public static function registerType(ModelBuilder $modelBuilder): void
self::$loopCharacteristicsChild = $sequenceBuilder->element(LoopCharacteristicsInterface::class)
->build();

self::$extensionElementsChild = $sequenceBuilder->element(ExtensionElementsInterface::class)
->build();

$typeBuilder->build();
}

Expand Down Expand Up @@ -176,4 +181,14 @@ public function setLoopCharacteristics(LoopCharacteristicsInterface $loopCharact
{
self::$loopCharacteristicsChild->setChild($this, $loopCharacteristics);
}

public function getExtensionElements(): ExtensionElementsInterface
{
return self::$extensionElementsChild->getChild($this);
}

public function setExtensionElements(ExtensionElementsInterface $extensionElements): void
{
self::$extensionElementsChild->setChild($this, $extensionElements);
}
}
4 changes: 4 additions & 0 deletions src/Instance/ActivityInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,8 @@ public function getResourceRoles(): array;
public function getLoopCharacteristics(): LoopCharacteristicsInterface;

public function setLoopCharacteristics(LoopCharacteristicsInterface $loopCharacteristics): void;

public function getExtensionElements(): ExtensionElementsInterface;

public function setExtensionElements(ExtensionElementsInterface $extensionElements): void;
}
1 change: 1 addition & 0 deletions src/Resources/Semantic.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<xsd:element ref="dataOutputAssociation" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element ref="resourceRole" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element ref="loopCharacteristics" minOccurs="0"/>
<xsd:element ref="extensionElements" minOccurs="0" maxOccurs="1" />
</xsd:sequence>
<xsd:attribute name="isForCompensation" type="xsd:boolean" default="false"/>
<xsd:attribute name="startQuantity" type="xsd:integer" default="1"/>
Expand Down
4 changes: 3 additions & 1 deletion tests/Instance/ActivityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Bpmn\Instance\{
DataInputAssociationInterface,
DataOutputAssociationInterface,
ExtensionElementsInterface,
FlowNodeInterface,
IoSpecificationInterface,
PropertyInterface,
Expand All @@ -31,7 +32,8 @@ public function getChildElementAssumptions(): array
new BpmnChildElementAssumption($this->model, DataInputAssociationInterface::class),
new BpmnChildElementAssumption($this->model, DataOutputAssociationInterface::class),
new BpmnChildElementAssumption($this->model, ResourceRoleInterface::class),
new BpmnChildElementAssumption($this->model, LoopCharacteristicsInterface::class, 0, 1)
new BpmnChildElementAssumption($this->model, LoopCharacteristicsInterface::class, 0, 1),
new BpmnChildElementAssumption($this->model, ExtensionElementsInterface::class, 0, 1)
];
}

Expand Down
1 change: 1 addition & 0 deletions tests/Resources/TextAnnotationTest.bpmn
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<bpmn2:userTask id="userTask" name="User Task">
<bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
<bpmn2:extensionElements></bpmn2:extensionElements>
</bpmn2:userTask>
<bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="userTask" targetRef="theEnd"/>
<bpmn2:endEvent id="theEnd">
Expand Down

0 comments on commit fa1d6c2

Please sign in to comment.