|
10 | 10 | import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.Classification; |
11 | 11 | import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EntityDetail; |
12 | 12 | import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EntityProxy; |
| 13 | +import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceHeader; |
13 | 14 | import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.Relationship; |
14 | 15 | import org.slf4j.Logger; |
15 | 16 | import org.slf4j.LoggerFactory; |
|
19 | 20 | import java.util.HashSet; |
20 | 21 | import java.util.List; |
21 | 22 | import java.util.Set; |
| 23 | +import java.util.stream.Collectors; |
22 | 24 |
|
23 | 25 | /** |
24 | 26 | * DuplicateEntityIterator retrieves the list of entities that need to be processed for a specific entity. |
@@ -180,6 +182,7 @@ private void getNextEntity() throws InvalidParameterException, |
180 | 182 | { |
181 | 183 | log.debug("KnownDuplicate classification detected"); |
182 | 184 | deduplicationNeeded = true; |
| 185 | + break; |
183 | 186 | } |
184 | 187 | } |
185 | 188 | } |
@@ -269,17 +272,23 @@ private void getNextEntity() throws InvalidParameterException, |
269 | 272 | */ |
270 | 273 | final String guidParameterName = "peerProxy.getGUID()"; |
271 | 274 |
|
272 | | - EntityDetail peerEntity = repositoryHandler.validateEntityGUID(userId, |
273 | | - peerProxy.getGUID(), |
274 | | - guidParameterName, |
275 | | - entityTypeName, |
276 | | - methodName); |
277 | | - |
278 | 275 | /* |
279 | | - * Save the entity for later processing since it may link to peer entities that the current processing entity |
280 | | - * does not know about. |
| 276 | + * Filter out the peers that were already added to the list of unprocessed peers. |
281 | 277 | */ |
282 | | - unprocessedPeers.add(peerEntity); |
| 278 | + if(!unprocessedPeers.stream().map(InstanceHeader::getGUID).collect(Collectors.toList()).contains(peerProxy.getGUID())) |
| 279 | + { |
| 280 | + EntityDetail peerEntity = repositoryHandler.validateEntityGUID(userId, |
| 281 | + peerProxy.getGUID(), |
| 282 | + guidParameterName, |
| 283 | + entityTypeName, |
| 284 | + methodName); |
| 285 | + |
| 286 | + /* |
| 287 | + * Save the entity for later processing since it may link to peer entities that the current processing entity |
| 288 | + * does not know about. |
| 289 | + */ |
| 290 | + unprocessedPeers.add(peerEntity); |
| 291 | + } |
283 | 292 | } |
284 | 293 | } |
285 | 294 | } |
|
0 commit comments