Skip to content

Commit

Permalink
Move synchronization actions into own container
Browse files Browse the repository at this point in the history
This way the actions are separated from the rest of the reaction
definition. It is more verbose but cleaner from the GUI & IDE point
of view.
  • Loading branch information
mederly committed Apr 26, 2022
1 parent 933e5ef commit 27eb64a
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 160 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,19 @@ private List<SynchronizationActionDefinition> createActions(
}

private List<AbstractSynchronizationActionType> getAllActionBeans(@NotNull SynchronizationReactionNewType reaction) {
SynchronizationActionsNewType actions = reaction.getActions();
if (actions == null) {
return List.of();
}
List<AbstractSynchronizationActionType> all = new ArrayList<>();
all.addAll(reaction.getSynchronize());
all.addAll(reaction.getLink());
all.addAll(reaction.getUnlink());
all.addAll(reaction.getAddFocus());
all.addAll(reaction.getDeleteFocus());
all.addAll(reaction.getInactivateFocus());
all.addAll(reaction.getDeleteShadow());
all.addAll(reaction.getInactivateShadow());
all.addAll(actions.getSynchronize());
all.addAll(actions.getLink());
all.addAll(actions.getUnlink());
all.addAll(actions.getAddFocus());
all.addAll(actions.getDeleteFocus());
all.addAll(actions.getInactivateFocus());
all.addAll(actions.getDeleteShadow());
all.addAll(actions.getInactivateShadow());
// TODO support extensions
return all;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4098,7 +4098,7 @@
</xsd:annotation>
</xsd:element>
<xsd:element name="dependency" type="tns:ResourceObjectTypeDependencyType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="association" type="tns:ResourceObjectAssociationType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="association" type="tns:ResourceObjectAssociationType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="volatility" type="tns:ResourceObjectVolatilityType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,21 @@
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<!-- Actions follow here -->
<xsd:element name="actions" type="tns:SynchronizationActionsNewType" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="SynchronizationActionsNewType">
<xsd:annotation>
<xsd:documentation>
Action(s) that have to be executed in specified synchronization situation.
</xsd:documentation>
<xsd:appinfo>
<a:container>true</a:container>
<a:since>4.6</a:since>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="synchronize" type="tns:SynchronizeSynchronizationActionType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="link" type="tns:LinkSynchronizationActionType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="unlink" type="tns:UnlinkSynchronizationActionType" minOccurs="0" maxOccurs="unbounded"/>
Expand Down
140 changes: 0 additions & 140 deletions model/model-impl/src/test/resources/common/resource-dummy-scripts.xml

This file was deleted.

31 changes: 21 additions & 10 deletions model/model-impl/src/test/resources/common/resource-dummy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
xmlns:piracy="http://midpoint.evolveum.com/xml/ns/samples/piracy">

<name>Dummy Resource</name>
<include>
<resourceRef oid="2d57470c-0062-4014-8c16-5c467ec66f79"/>
</include>
<connectorRef type="c:ConnectorType">
<filter>
<q:and>
Expand Down Expand Up @@ -289,15 +286,21 @@
<reaction>
<situation>linked</situation>
<situation>deleted</situation>
<synchronize/>
<actions>
<synchronize/>
</actions>
</reaction>
<reaction>
<situation>unlinked</situation>
<link/>
<actions>
<link/>
</actions>
</reaction>
<reaction>
<situation>unmatched</situation>
<addFocus/>
<actions>
<addFocus/>
</actions>
</reaction>
</synchronization>

Expand Down Expand Up @@ -354,19 +357,27 @@
<synchronization>
<reaction>
<situation>linked</situation>
<synchronize/>
<actions>
<synchronize/>
</actions>
</reaction>
<reaction>
<situation>deleted</situation>
<unlink/>
<actions>
<unlink/>
</actions>
</reaction>
<reaction>
<situation>unlinked</situation>
<link/>
<actions>
<link/>
</actions>
</reaction>
<reaction>
<situation>unmatched</situation>
<addFocus/>
<actions>
<addFocus/>
</actions>
</reaction>
</synchronization>
</objectType>
Expand Down

0 comments on commit 27eb64a

Please sign in to comment.