Commit f912aa89 by Ashutosh Mestry

ATLAS-3050: DataAccess Save error handling. Picked from branch-0.8.

parent fb54a29d
...@@ -72,10 +72,6 @@ public class DataAccess { ...@@ -72,10 +72,6 @@ public class DataAccess {
AtlasEntityWithExtInfo entityWithExtInfo = dto.toEntityWithExtInfo(obj); AtlasEntityWithExtInfo entityWithExtInfo = dto.toEntityWithExtInfo(obj);
EntityMutationResponse entityMutationResponse = entityStore.createOrUpdate(new AtlasEntityStream(entityWithExtInfo), false); EntityMutationResponse entityMutationResponse = entityStore.createOrUpdate(new AtlasEntityStream(entityWithExtInfo), false);
if (noEntityMutation(entityMutationResponse)) {
throw new AtlasBaseException(AtlasErrorCode.DATA_ACCESS_SAVE_FAILED, obj.toString());
}
// Update GUID assignment for newly created entity // Update GUID assignment for newly created entity
if (CollectionUtils.isNotEmpty(entityMutationResponse.getCreatedEntities())) { if (CollectionUtils.isNotEmpty(entityMutationResponse.getCreatedEntities())) {
String assignedGuid = entityMutationResponse.getGuidAssignments().get(obj.getGuid()); String assignedGuid = entityMutationResponse.getGuidAssignments().get(obj.getGuid());
...@@ -263,8 +259,5 @@ public class DataAccess { ...@@ -263,8 +259,5 @@ public class DataAccess {
} }
} }
// Helper functions
private boolean noEntityMutation(EntityMutationResponse er) {
return er == null || (CollectionUtils.isEmpty(er.getCreatedEntities()) && CollectionUtils.isEmpty(er.getUpdatedEntities()));
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment