@Override @GraphTransaction public AtlasClient.EntityResult deleteEntities(List<String> guids) throws RepositoryException { if (guids == null || guids.size() == 0) { throw new IllegalArgumentException("guids must be non-null and non-empty"); } for (String guid : guids) { if (guid == null) { LOG.warn("deleteEntities: Ignoring null guid"); continue; } try { Vertex instanceVertex = graphHelper.getVertexForGUID(guid); deleteHandler.deleteEntity(instanceVertex); } catch (EntityNotFoundException e) { // Entity does not exist - treat as non-error, since the caller // wanted to delete the entity and it's already gone. LOG.info("Deletion request ignored for non-existent entity with guid " + guid); continue; } catch (AtlasException e) { throw new RepositoryException(e); } } RequestContext requestContext = RequestContext.get(); return new AtlasClient.EntityResult( requestContext.getCreatedEntityIds(), requestContext.getUpdatedEntityIds(), requestContext.getDeletedEntityIds()); }
@Override @GraphTransaction public AtlasClient.EntityResult updatePartial(ITypedReferenceableInstance entity) throws RepositoryException { LOG.debug("updating entity {}", entity); try { TypedInstanceToGraphMapper instanceToGraphMapper = new TypedInstanceToGraphMapper(graphToInstanceMapper, deleteHandler); instanceToGraphMapper.mapTypedInstanceToGraph( TypedInstanceToGraphMapper.Operation.UPDATE_PARTIAL, entity); RequestContext requestContext = RequestContext.get(); return new AtlasClient.EntityResult( requestContext.getCreatedEntityIds(), requestContext.getUpdatedEntityIds(), requestContext.getDeletedEntityIds()); } catch (AtlasException e) { throw new RepositoryException(e); } }