diff --git a/repository/src/main/java/org/apache/atlas/repository/store/aliasstore/ESAliasStore.java b/repository/src/main/java/org/apache/atlas/repository/store/aliasstore/ESAliasStore.java index 88fdf0f4af..1991106b96 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/aliasstore/ESAliasStore.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/aliasstore/ESAliasStore.java @@ -141,23 +141,6 @@ public boolean updateAlias(AtlasEntity.AtlasEntityWithExtInfo accessControl, Atl return true; } - public void rebuildAlias(AtlasEntity.AtlasEntityWithExtInfo accessControl) throws AtlasBaseException { - String aliasName = getAliasName(accessControl.getEntity()); - - Map filter; - - if (PERSONA_ENTITY_TYPE.equals(accessControl.getEntity().getTypeName())) { - filter = getFilterForPersona(accessControl); - } else { - filter = getFilterForPurpose(accessControl.getEntity()); - } - - ESAliasRequestBuilder requestBuilder = new ESAliasRequestBuilder(); - requestBuilder.addAction(ADD, new AliasAction(getIndexNameFromAliasIfExists(VERTEX_INDEX_NAME), aliasName, filter)); - - graph.createOrUpdateESAlias(requestBuilder); - } - @Override public boolean deleteAlias(String aliasName) throws AtlasBaseException { graph.deleteESAlias(getIndexNameFromAliasIfExists(VERTEX_INDEX_NAME), aliasName); @@ -178,17 +161,6 @@ private Map getFilterForPersona(AtlasEntity.AtlasEntityWithExtIn return esClausesToFilter(allowClauseList); } - private Map getFilterForPersona(AtlasEntity.AtlasEntityWithExtInfo persona) throws AtlasBaseException { - List> allowClauseList = new ArrayList<>(); - - List policies = getPolicies(persona); - if (CollectionUtils.isNotEmpty(policies)) { - personaPolicyToESDslClauses(policies, allowClauseList); - } - - return esClausesToFilter(allowClauseList); - } - private Map getFilterForPurpose(AtlasEntity purpose) throws AtlasBaseException { List> allowClauseList = new ArrayList<>(); diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java index 037fadbc17..83df0fe2ef 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java @@ -2716,10 +2716,6 @@ public void repairAccesscontrolAlias(String guid) throws AtlasBaseException { AtlasAuthorizationUtils.verifyAccess(new AtlasEntityAccessRequest(typeRegistry, AtlasPrivilege.ENTITY_UPDATE, new AtlasEntityHeader(accesscontrolEntity.getEntity()))); - if (accesscontrolEntity == null) { - throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_NOT_FOUND, guid); - } - // Validate accesscontrolEntity status if (accesscontrolEntity.getEntity().getStatus() != ACTIVE) { throw new AtlasBaseException(AtlasErrorCode.INSTANCE_GUID_DELETED, guid); @@ -2728,7 +2724,7 @@ public void repairAccesscontrolAlias(String guid) throws AtlasBaseException { // Validate accesscontrolEntity type String entityType = accesscontrolEntity.getEntity().getTypeName(); if (!PERSONA_ENTITY_TYPE.equals(entityType)) { - throw new AtlasBaseException(AtlasErrorCode.INVALID_OBJECT_ID, entityType); + throw new AtlasBaseException(AtlasErrorCode.OPERATION_NOT_SUPPORTED, entityType); } List policies = (List) accesscontrolEntity.getEntity().getRelationshipAttribute(REL_ATTR_POLICIES); @@ -2737,7 +2733,7 @@ public void repairAccesscontrolAlias(String guid) throws AtlasBaseException { } // Rebuild alias - this.esAliasStore.rebuildAlias(accesscontrolEntity); + this.esAliasStore.updateAlias(accesscontrolEntity, null); RequestContext.get().endMetricRecord(metric); }