fix(recommendations): Check whether an entity exists before recommending (#5163)

This commit is contained in:
John Joyce 2022-06-14 13:51:06 -04:00 committed by GitHub
parent 66b9676567
commit 0c619ff393
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -74,10 +74,15 @@ public class EntityUtils {
}
/**
* Check if entity is removed (removed=true in Status aspect)
* Check if entity is removed (removed=true in Status aspect) and exists
*/
public static boolean checkIfRemoved(EntityService entityService, Urn entityUrn) {
try {
if (!entityService.exists(entityUrn)) {
return false;
}
EnvelopedAspect statusAspect =
entityService.getLatestEnvelopedAspect(entityUrn.getEntityType(), entityUrn, "status");
if (statusAspect == null) {