Skip to content

Commit

Permalink
feat: add more checks
Browse files Browse the repository at this point in the history
  • Loading branch information
sumandas0 committed Jun 4, 2024
1 parent f38a52a commit 3cd1e03
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2709,8 +2709,25 @@ private void repairMeanings(AtlasVertex assetVertex) {
}
@Override
public void repairAlias(String guid) throws AtlasBaseException {
// Fetch entity with extenfo
// Fetch entity with extInfo
AtlasEntity.AtlasEntityWithExtInfo entity = entityRetriever.toAtlasEntityWithExtInfo(guid);

if (entity == null) {
throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid);
}

// Validate entity status
if (entity.getEntity().getStatus() != ACTIVE) {
throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_DELETED, guid);
}

// Validate entity type
String entityType = entity.getEntity().getTypeName();
if (!PERSONA_ENTITY_TYPE.equals(entityType)) {
throw new AtlasBaseException(AtlasErrorCode.INVALID_OBJECT_ID, entityType);
}

// Rebuild alias
this.esAliasStore.rebuildAlias(entity);
}
}
Expand Down

0 comments on commit 3cd1e03

Please sign in to comment.