From 0e190da4aa8dcc36f80d8d25b36d3e8faf9eab91 Mon Sep 17 00:00:00 2001 From: Raluca Popa Date: Tue, 20 Sep 2022 09:17:47 +0200 Subject: [PATCH 1/3] Dedup connector - link only the first duplicate found as peer Signed-off-by: Raluca Popa --- .../QualifiedNamePeerDuplicateGovernanceActionConnector.java | 1 + 1 file changed, 1 insertion(+) diff --git a/open-metadata-implementation/adapters/open-connectors/governance-action-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/governanceactions/remediation/QualifiedNamePeerDuplicateGovernanceActionConnector.java b/open-metadata-implementation/adapters/open-connectors/governance-action-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/governanceactions/remediation/QualifiedNamePeerDuplicateGovernanceActionConnector.java index d986295944d..4ae080857e2 100644 --- a/open-metadata-implementation/adapters/open-connectors/governance-action-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/governanceactions/remediation/QualifiedNamePeerDuplicateGovernanceActionConnector.java +++ b/open-metadata-implementation/adapters/open-connectors/governance-action-connectors/src/main/java/org/odpi/openmetadata/adapters/connectors/governanceactions/remediation/QualifiedNamePeerDuplicateGovernanceActionConnector.java @@ -78,6 +78,7 @@ public void start() throws ConnectorCheckedException { null, null, null, null, null, true); outputGuards.add(QualifiedNamePeerDuplicateGovernanceActionProvider.DUPLICATE_ASSIGNED_GUARD); completionStatus = CompletionStatus.ACTIONED; + break; } } } From 0f38543bc83a02c35ce6d8830b7018cd449babfa Mon Sep 17 00:00:00 2001 From: Raluca Popa Date: Tue, 20 Sep 2022 09:22:23 +0200 Subject: [PATCH 2/3] Add peer to unprocessedPeers only if the entity with the same guid is not present in the list Signed-off-by: Raluca Popa --- .../DuplicateEntityIterator.java | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/open-metadata-implementation/common-services/repository-handler/src/main/java/org/odpi/openmetadata/commonservices/repositoryhandler/DuplicateEntityIterator.java b/open-metadata-implementation/common-services/repository-handler/src/main/java/org/odpi/openmetadata/commonservices/repositoryhandler/DuplicateEntityIterator.java index f2caa1647fd..32d3ce8c733 100644 --- a/open-metadata-implementation/common-services/repository-handler/src/main/java/org/odpi/openmetadata/commonservices/repositoryhandler/DuplicateEntityIterator.java +++ b/open-metadata-implementation/common-services/repository-handler/src/main/java/org/odpi/openmetadata/commonservices/repositoryhandler/DuplicateEntityIterator.java @@ -10,6 +10,7 @@ import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.Classification; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EntityDetail; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EntityProxy; +import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceHeader; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.Relationship; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -19,6 +20,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; +import java.util.stream.Collectors; /** * DuplicateEntityIterator retrieves the list of entities that need to be processed for a specific entity. @@ -269,17 +271,23 @@ private void getNextEntity() throws InvalidParameterException, */ final String guidParameterName = "peerProxy.getGUID()"; - EntityDetail peerEntity = repositoryHandler.validateEntityGUID(userId, - peerProxy.getGUID(), - guidParameterName, - entityTypeName, - methodName); - /* - * Save the entity for later processing since it may link to peer entities that the current processing entity - * does not know about. + * Filter out the peers that were already added to the list of unprocessed peers. */ - unprocessedPeers.add(peerEntity); + if(!unprocessedPeers.stream().map(InstanceHeader::getGUID).collect(Collectors.toList()).contains(peerProxy.getGUID())) + { + EntityDetail peerEntity = repositoryHandler.validateEntityGUID(userId, + peerProxy.getGUID(), + guidParameterName, + entityTypeName, + methodName); + + /* + * Save the entity for later processing since it may link to peer entities that the current processing entity + * does not know about. + */ + unprocessedPeers.add(peerEntity); + } } } } From 2dda1fadf82782a150562c03dc9a59c5a327a5f6 Mon Sep 17 00:00:00 2001 From: Raluca Popa Date: Tue, 20 Sep 2022 09:23:16 +0200 Subject: [PATCH 3/3] Stop searching for duplicate classification if already found Signed-off-by: Raluca Popa --- .../repositoryhandler/DuplicateEntityIterator.java | 1 + 1 file changed, 1 insertion(+) diff --git a/open-metadata-implementation/common-services/repository-handler/src/main/java/org/odpi/openmetadata/commonservices/repositoryhandler/DuplicateEntityIterator.java b/open-metadata-implementation/common-services/repository-handler/src/main/java/org/odpi/openmetadata/commonservices/repositoryhandler/DuplicateEntityIterator.java index 32d3ce8c733..5eb56e3e9e6 100644 --- a/open-metadata-implementation/common-services/repository-handler/src/main/java/org/odpi/openmetadata/commonservices/repositoryhandler/DuplicateEntityIterator.java +++ b/open-metadata-implementation/common-services/repository-handler/src/main/java/org/odpi/openmetadata/commonservices/repositoryhandler/DuplicateEntityIterator.java @@ -182,6 +182,7 @@ private void getNextEntity() throws InvalidParameterException, { log.debug("KnownDuplicate classification detected"); deduplicationNeeded = true; + break; } } }