Skip to content

Commit

Permalink
Add basic correlation cases management
Browse files Browse the repository at this point in the history
ID Match correlator now creates, updates, and closes correlation cases
depending on the result of matching. (In a very basic way, for now.)

Also adapted failing TestIntegrationObjectWrapperFactory.
  • Loading branch information
mederly committed Jan 13, 2022
1 parent 77c64aa commit 266b3b6
Show file tree
Hide file tree
Showing 12 changed files with 624 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<!--
~ Copyright (c) 2019 Evolveum and contributors
~
~ This work is dual-licensed under the Apache License 2.0
~ and European Union Public License. See LICENSE file for details.
-->
<archetype oid="00000000-0000-0000-0000-000000000345"
xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3">
<name>Correlation case</name>
<description>
Archetype for correlation cases.
</description>
<archetypePolicy>
<display>
<label>Correlation case</label>
<pluralLabel>Correlation cases</pluralLabel>
<icon>
<cssClass>fe fe-approver-object</cssClass> <!-- TODO -->
</icon>
</display>
<adminGuiConfiguration>
<objectDetails>
<panel>
<identifier>caseWorkItems</identifier>
<display>
<label>Workitems</label>
<icon>
<cssClass>fa fa-circle-o</cssClass>
</icon>
</display>
<panelType>caseWorkItems</panelType>
<type>c:CaseType</type>
</panel>
<panel> <!-- TODO -->
<identifier>approvalCase</identifier>
<display>
<label>Approvals</label>
<icon>
<cssClass>fa fa-circle-o</cssClass>
</icon>
</display>
<displayOrder>1</displayOrder>
<panelType>approvalCase</panelType>
<type>c:CaseType</type>
<default>true</default>
</panel>
</objectDetails>
</adminGuiConfiguration>
</archetypePolicy>
<assignment>
<assignmentRelation>
<holderType>CaseType</holderType>
</assignmentRelation>
</assignment>
</archetype>
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ public class TestIntegrationObjectWrapperFactory extends AbstractInitializedGuiI
ShadowType.F_ASSOCIATION,
ShadowType.F_ACTIVATION,
ShadowType.F_CREDENTIALS,
ShadowType.F_POLICY_EXCEPTION);
ShadowType.F_POLICY_EXCEPTION,
ShadowType.F_CORRELATION_STATE);
private static final List<ItemPath> BASIC_ORG_CONTAINERS_PATHS = Arrays.asList(
OrgType.F_EXTENSION,
OrgType.F_ASSIGNMENT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,17 @@
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="correlationContext" type="tns:CorrelationContextType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Information related to correlation request that is to be resolved.
</xsd:documentation>
<xsd:appinfo>
<a:since>4.5</a:since>
<a:experimental>true</a:experimental>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="taskRef" type="tns:ObjectReferenceType" minOccurs="0" maxOccurs="1">
<xsd:annotation>
<xsd:documentation>
Expand Down Expand Up @@ -1287,4 +1298,111 @@
</xsd:complexType>
<xsd:element name="manualProvisioningContext" type="tns:ManualProvisioningContextType" />

<xsd:complexType name="CorrelationContextType">
<xsd:annotation>
<xsd:documentation>
Information related to correlation request that is to be resolved.
TODO resolve naming collision with CorrelationContext
</xsd:documentation>
<xsd:appinfo>
<a:since>4.5</a:since>
<a:experimental>true</a:experimental>
<a:container>true</a:container>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="correlatorPart" type="tns:AbstractCorrelationContextType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Parts of the context specific to a given correlation.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:long"/>
</xsd:complexType>
<xsd:element name="correlationContext" type="tns:CorrelationContextType" />

<xsd:complexType name="AbstractCorrelationContextType">
<xsd:annotation>
<xsd:documentation>
Parts of the context specific to a given correlator.
</xsd:documentation>
<xsd:appinfo>
<a:since>4.5</a:since>
<a:experimental>true</a:experimental>
<a:container>true</a:container>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<!-- anything here? -->
</xsd:sequence>
<xsd:attribute name="id" type="xsd:long"/>
</xsd:complexType>

<xsd:complexType name="IdMatchCorrelationContextType">
<xsd:annotation>
<xsd:documentation>
Parts of the context specific to ID Match correlator.
</xsd:documentation>
<xsd:appinfo>
<a:since>4.5</a:since>
<a:container>true</a:container>
<a:experimental>true</a:experimental>
</xsd:appinfo>
</xsd:annotation>
<xsd:complexContent>
<xsd:extension base="tns:AbstractCorrelationContextType">
<xsd:sequence>
<xsd:element name="potentialMatch" type="tns:IdMatchCorrelationPotentialMatchType"
minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:documentation>
Potential matches among which (if any) the user should decide. Should be at least one,
otherwise there's nothing to decide.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="idMatchCorrelationContext" type="tns:IdMatchCorrelationContextType"/>

<xsd:complexType name="IdMatchCorrelationPotentialMatchType">
<xsd:annotation>
<xsd:documentation>
A potential match found by ID Match service.
</xsd:documentation>
<xsd:appinfo>
<a:since>4.5</a:since>
<a:experimental>true</a:experimental>
<a:container>true</a:container>
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="confidence" type="xsd:int" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
An integer between 0 and 100.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="referenceId" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Reference ID of the entity.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="attributes" type="c:ShadowAttributesType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Attributes of the entity.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:long"/>
</xsd:complexType>
</xsd:schema>
Original file line number Diff line number Diff line change
Expand Up @@ -19103,6 +19103,13 @@
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="00000000-0000-0000-0000-000000000345">
<xsd:annotation>
<xsd:appinfo>
<jaxb:typesafeEnumMember name="ARCHETYPE_CORRELATION_CASE"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="00000000-0000-0000-0000-000000000501">
<xsd:annotation>
<xsd:appinfo>
Expand Down Expand Up @@ -23436,6 +23443,7 @@
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<!-- TODO operator -->
<xsd:element name="followOn" type="tns:CorrelatorsType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Expand Down Expand Up @@ -23714,6 +23722,8 @@
</xsd:annotation>
<xsd:sequence>
<!-- Should be anything here? -->
<!-- We could have a reference to case object here, but this link is maintained on the side of the case
(via case.objectRef). -->
</xsd:sequence>
<xsd:attribute name="id" type="xsd:long"/>
</xsd:complexType>
Expand Down Expand Up @@ -23751,5 +23761,4 @@
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="idMatchCorrelationState" type="tns:IdMatchCorrelationStateType"/>

</xsd:schema>
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* The context of the correlation operation(s).
*
* TODO decide on the exact use of this class -- will it be only at API level? Or will the correlator write its own notes here?
*
* TODO resolve naming conflict with CorrelationContextType
*/
public class CorrelationContext implements DebugDumpable {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ public PotentialMatch(int confidence, @NotNull String referenceId, @NotNull Shad
this.attributes = attributes;
}

public int getConfidence() {
return confidence;
}

public @NotNull String getReferenceId() {
return referenceId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.evolveum.midpoint.model.common.ModelCommonBeans;

import com.evolveum.midpoint.model.common.SystemObjectCache;
import com.evolveum.midpoint.model.impl.correlator.CorrelationCaseManager;
import com.evolveum.midpoint.model.impl.lens.*;
import com.evolveum.midpoint.model.impl.lens.projector.ContextLoader;
import com.evolveum.midpoint.model.impl.lens.projector.Projector;
Expand Down Expand Up @@ -121,4 +122,5 @@ public static ModelBeans get() {
@Autowired public ClockworkHookHelper clockworkHookHelper;
@Autowired public SecurityHelper securityHelper;
@Autowired public CorrelatorFactoryRegistry correlatorFactoryRegistry;
@Autowired public CorrelationCaseManager correlationCaseManager;
}

0 comments on commit 266b3b6

Please sign in to comment.