Skip to content

Commit

Permalink
Change "path" to "ref" in items correlator
Browse files Browse the repository at this point in the history
This is better aligned with items definitions in an object template
and attributes definitions in a resource object type definition.

(Incompatible change, but related to an experimental functionality.)
  • Loading branch information
mederly committed Aug 16, 2022
1 parent aff39e2 commit 3ebec98
Show file tree
Hide file tree
Showing 19 changed files with 49 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ private static void addCorrelationDefinitionFromAttribute(
new ItemsSubCorrelatorType()
.confidence(CloneUtil.clone(attributeCorrelationDefBean.getConfidence()))
.item(new ItemCorrelationType()
.path(itemPathBean.clone())));
.ref(itemPathBean.clone())));
}

private static ItemPathType determineItemPathBean(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class CorrelationItemDefinitionUtil {
if (definitionBean.getName() != null) {
return definitionBean.getName();
}
String nameFromPath = getNameFromPath(definitionBean.getPath());
String nameFromPath = getNameFromPath(definitionBean.getRef());
if (nameFromPath != null) {
return nameFromPath;
}
Expand Down Expand Up @@ -99,7 +99,7 @@ public static String identify(@Nullable AbstractCorrelatorType configBean) {
sb.append("items: ");
sb.append(
((ItemsCorrelatorType) configBean).getItem().stream()
.map(itemDef -> String.valueOf(itemDef.getPath()))
.map(itemDef -> String.valueOf(itemDef.getRef()))
.collect(Collectors.joining(", ")));
} else {
sb.append("configured with: ")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@
</xsd:element>
<xsd:element ref="tns:description" minOccurs="0"/>
<xsd:element ref="tns:documentation" minOccurs="0"/>
<xsd:element name="path" type="t:ItemPathType" minOccurs="0">
<xsd:element name="ref" type="t:ItemPathType" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
TODO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ CorrelationCaseDescription.Match determine(Task task, OperationResult result)
.filter(bean -> bean instanceof ItemsCorrelatorType)
.map(bean -> (ItemsCorrelatorType) bean)
.flatMap(bean -> bean.getItem().stream())
.filter(item -> item.getPath() != null && item.getPath().getItemPath().equivalent(itemPath))
.filter(item -> item.getRef() != null && item.getRef().getItemPath().equivalent(itemPath))
.collect(Collectors.toSet());

if (!correlationDefSet.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ private static Normalization getNormalization(IndexingItemConfiguration indexing

private static IndexingItemConfiguration getIndexingItemConfiguration(
@NotNull ItemCorrelationType itemBean, @NotNull CorrelatorContext<?> correlatorContext) {
ItemPathType itemPathBean = itemBean.getPath();
ItemPathType itemPathBean = itemBean.getRef();
if (itemPathBean != null) {
return correlatorContext.getIndexingConfiguration().getForPath(itemPathBean.getItemPath());
} else {
Expand All @@ -155,7 +155,7 @@ private static IndexingItemConfiguration getIndexingItemConfiguration(
if (explicitName != null) {
return explicitName;
}
ItemPathType pathBean = itemBean.getPath();
ItemPathType pathBean = itemBean.getRef();
if (pathBean != null) {
ItemName lastName = pathBean.getItemPath().lastName();
if (lastName != null) {
Expand All @@ -166,9 +166,8 @@ private static IndexingItemConfiguration getIndexingItemConfiguration(
"Couldn't determine name for correlation item: no name nor path in " + itemBean);
}

// Temporary code
private static @NotNull ItemPath getPath(@NotNull ItemCorrelationType itemBean) throws ConfigurationException {
ItemPathType specifiedPath = itemBean.getPath();
ItemPathType specifiedPath = itemBean.getRef();
if (specifiedPath != null) {
return specifiedPath.getItemPath();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3">
<name>by-name-default</name>
<item>
<path>givenName</path>
<ref>givenName</ref>
</item>
<item>
<path>familyName</path>
<ref>familyName</ref>
</item>
</itemsCorrelator>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<name>by-name-fuzzy-gradual</name>
<description>Filters using broad fuzzy conditions, and computes the confidence according to the proximity of the matches.</description>
<item>
<path>givenName</path>
<ref>givenName</ref>
<search>
<fuzzy>
<levenshtein>
Expand All @@ -28,7 +28,7 @@
</search>
</item>
<item>
<path>familyName</path>
<ref>familyName</ref>
<search>
<fuzzy>
<similarity>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3">
<name>by-name-levenshtein</name>
<item>
<path>givenName</path>
<ref>givenName</ref>
<search>
<fuzzy>
<levenshtein>
Expand All @@ -19,7 +19,7 @@
</search>
</item>
<item>
<path>familyName</path>
<ref>familyName</ref>
<search>
<fuzzy>
<similarity>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
</expression>
</confidence>
<item>
<path>givenName</path>
<ref>givenName</ref>
</item>
<item>
<path>familyName</path>
<ref>familyName</ref>
</item>
</itemsCorrelator>
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
<items>
<name>full</name>
<item>
<path>givenName</path>
<ref>givenName</ref>
</item>
<item>
<path>familyName</path>
<ref>familyName</ref>
<search>
<index>orig</index> <!-- just for testing -->
</search>
</item>
<item>
<path>extension/nationalId</path>
<ref>extension/nationalId</ref>
</item>
<composition>
<tier>1</tier>
Expand All @@ -32,10 +32,10 @@
<items>
<name>both-names</name>
<item>
<path>givenName</path>
<ref>givenName</ref>
</item>
<item>
<path>familyName</path>
<ref>familyName</ref>
</item>
<composition>
<weight>0.5</weight>
Expand All @@ -45,7 +45,7 @@
<items>
<name>familyName</name>
<item>
<path>familyName</path>
<ref>familyName</ref>
</item>
<composition>
<weight>0.25</weight>
Expand All @@ -56,7 +56,7 @@
<!-- just for the testing, not to be used in real life! -->
<name>givenName</name>
<item>
<path>givenName</path>
<ref>givenName</ref>
</item>
<composition>
<weight>0.1</weight>
Expand All @@ -66,7 +66,7 @@
<items>
<name>nationalId</name>
<item>
<path>extension/nationalId</path>
<ref>extension/nationalId</ref>
</item>
<composition>
<weight>0.75</weight>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
<correlators>
<items>
<item>
<path>extension/personalNumber</path>
<ref>extension/personalNumber</ref>
</item>
</items>
</correlators>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<correlators>
<items>
<item>
<path>extension/personalNumber</path>
<ref>extension/personalNumber</ref>
</item>
</items>
</correlators>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
<items>
<name>itemCorrelator</name>
<item>
<path>employeeNumber</path>
<ref>employeeNumber</ref>
</item>
</items>
</correlators>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ public void test210ObjectTypesFull() throws Exception {
() -> new AssertionError("multiple empNo correlators"),
() -> new AssertionError("no empNo correlator"));
// Use of toString() is a hack (it's hard to compare paths using equals())
assertThat(empNo.getItem().get(0).getPath().getItemPath().toString()).as("empNo path")
assertThat(empNo.getItem().get(0).getRef().getItemPath().toString()).as("empNo path")
.isEqualTo(prismContext.toUniformPath(UserType.F_EMPLOYEE_NUMBER).toString());
ItemsCorrelatorType unnamedCorrelator = MiscUtil.extractSingletonRequired(
itemsCorrelators.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@
<correlators>
<items> <!-- this is a new one -->
<item>
<path>givenName</path>
<ref>givenName</ref>
</item>
<item>
<path>fullName</path>
<ref>fullName</ref>
</item>
</items>
</correlators>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
<items>
<name>empNo</name>
<item>
<path>employeeNumber</path>
<ref>employeeNumber</ref>
</item>
</items>
</correlators>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,13 @@
we are immediately done. We ignore given name here.
</documentation>
<item>
<path>familyName</path>
<ref>familyName</ref>
</item>
<item>
<path>extension/dateOfBirth</path>
<ref>extension/dateOfBirth</ref>
</item>
<item>
<path>extension/nationalId</path>
<ref>extension/nationalId</ref>
</item>
<composition>
<tier>1</tier>
Expand All @@ -126,13 +126,13 @@
<name>names-date</name>
<documentation>If given and family name and the date of birth match, we present an option to the operator.</documentation>
<item>
<path>givenName</path>
<ref>givenName</ref>
</item>
<item>
<path>familyName</path>
<ref>familyName</ref>
</item>
<item>
<path>extension/dateOfBirth</path>
<ref>extension/dateOfBirth</ref>
</item>
<composition>
<weight>0.1</weight>
Expand All @@ -142,7 +142,7 @@
<name>id</name>
<documentation>If national ID matches, we present an option to the operator.</documentation>
<item>
<path>extension/nationalId</path>
<ref>extension/nationalId</ref>
</item>
<composition>
<weight>0.1</weight>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@
we are immediately done. We ignore given name here.
</documentation>
<item>
<path>familyName</path>
<ref>familyName</ref>
</item>
<item>
<path>extension/dateOfBirth</path>
<ref>extension/dateOfBirth</ref>
</item>
<item>
<path>extension/nationalId</path>
<ref>extension/nationalId</ref>
</item>
<composition>
<tier>1</tier>
Expand All @@ -116,13 +116,13 @@
<name>names-date</name>
<documentation>If given and family name and the date of birth match, we present an option to the operator.</documentation>
<item>
<path>givenName</path>
<ref>givenName</ref>
</item>
<item>
<path>familyName</path>
<ref>familyName</ref>
</item>
<item>
<path>extension/dateOfBirth</path>
<ref>extension/dateOfBirth</ref>
</item>
<composition>
<weight>0.4</weight>
Expand All @@ -132,7 +132,7 @@
<name>id</name>
<documentation>If national ID matches, we present an option to the operator.</documentation>
<item>
<path>extension/nationalId</path>
<ref>extension/nationalId</ref>
</item>
<composition>
<weight>0.4</weight>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,31 +137,31 @@
<documentation>Implements correlation rules #1-#4 (see TestCorrelationSimple javadoc)</documentation>
<items>
<item>
<path>employeeNumber</path>
<ref>employeeNumber</ref>
</item>
<composition>
<tier>1</tier>
</composition>
</items>
<items>
<item>
<path>emailAddress</path>
<ref>emailAddress</ref>
</item>
<composition>
<tier>1</tier>
</composition>
</items>
<items>
<item>
<path>familyName</path>
<ref>familyName</ref>
</item>
<composition>
<weight>0.1</weight>
</composition>
</items>
<items>
<item>
<path>telephoneNumber</path>
<ref>telephoneNumber</ref>
</item>
<composition>
<weight>0.1</weight>
Expand Down

0 comments on commit 3ebec98

Please sign in to comment.