private String getSample(EntityResult entityResult) { String sample = getSample(entityResult.getCreatedEntities()); if (sample == null) { sample = getSample(entityResult.getUpdateEntities()); } return sample; }
protected EntityResult extractEntityResult(ObjectNode response) throws AtlasServiceException { return EntityResult.fromString(response.toString()); }
/** * Convenience method to get the guids of the deleted entities * from the EntityResult. */ public List<String> getDeletedEntities() { if (entityResult == null) { return Collections.emptyList(); } return getEntityResult().getDeletedEntities(); }
/** * Convenience method to get the guids of the created entities from * the EntityResult. */ public List<String> getCreatedEntities() { if(entityResult == null) { return Collections.emptyList(); } return getEntityResult().getCreatedEntities(); }
/** * Convenience method to get the guids of the updated entities from * the EntityResult. */ public List<String> getUpdatedEntities() { if(entityResult == null) { return Collections.emptyList(); } return getEntityResult().getUpdateEntities(); }
EntityResult entityResult = new EntityResult(); if (CollectionUtils.isNotEmpty(createdEntities)) { Collections.reverse(createdEntities); entityResult.set(EntityResult.OP_CREATED, getGuids(createdEntities)); if (CollectionUtils.isNotEmpty(updatedEntities)) { Collections.reverse(updatedEntities); entityResult.set(EntityResult.OP_UPDATED, getGuids(updatedEntities)); if (CollectionUtils.isNotEmpty(partialUpdatedEntities)) { Collections.reverse(partialUpdatedEntities); entityResult.set(EntityResult.OP_UPDATED, getGuids(partialUpdatedEntities)); if (CollectionUtils.isNotEmpty(deletedEntities)) { Collections.reverse(deletedEntities); entityResult.set(EntityResult.OP_DELETED, getGuids(deletedEntities));
@JsonIgnore public List<String> getCreatedEntities() { return get(OP_CREATED); }
private String getResponse(CreateUpdateEntitiesResult result) throws AtlasBaseException, AtlasException { Map<String, Object> response = new HashMap<>(); EntityResult entityResult = result.getEntityResult(); GuidMapping mapping = result.getGuidMapping(); response.put(AtlasClient.REQUEST_ID, Servlets.getRequestId()); if(entityResult != null) { response.put(AtlasClient.ENTITIES, entityResult.getEntities()); String sampleEntityId = getSample(result.getEntityResult()); if (sampleEntityId != null) { response.put(AtlasClient.DEFINITION, getEntity(sampleEntityId)); } } if(mapping != null) { response.put(AtlasClient.GUID_ASSIGNMENTS, mapping); } return AtlasJson.toV1Json(response); }
EntityResult entityResult = new EntityResult();
/** * Convenience method to get the guids of the created entities from * the EntityResult. */ public List<String> getCreatedEntities() { if(entityResult == null) { return Collections.emptyList(); } return getEntityResult().getCreatedEntities(); }
/** * Convenience method to get the guids of the updated entities from * the EntityResult. */ public List<String> getUpdatedEntities() { if(entityResult == null) { return Collections.emptyList(); } return getEntityResult().getUpdateEntities(); }
@JsonIgnore public List<String> getUpdateEntities() { return get(OP_UPDATED); }
/** * Convenience method to get the guids of the created entities from * the EntityResult. */ public List<String> getCreatedEntities() { if(entityResult == null) { return Collections.emptyList(); } return getEntityResult().getCreatedEntities(); }
/** * Convenience method to get the guids of the updated entities from * the EntityResult. */ public List<String> getUpdatedEntities() { if(entityResult == null) { return Collections.emptyList(); } return getEntityResult().getUpdateEntities(); }
protected EntityResult extractEntityResult(ObjectNode response) throws AtlasServiceException { return EntityResult.fromString(response.toString()); }
/** * Convenience method to get the guids of the deleted entities * from the EntityResult. */ public List<String> getDeletedEntities() { if (entityResult == null) { return Collections.emptyList(); } return getEntityResult().getDeletedEntities(); }
@JsonIgnore public List<String> getDeletedEntities() { return get(OP_DELETED); }
/** * Create the given entity * @param entities entity(type instance) as json * @return json array of guids * @throws AtlasServiceException */ protected List<String> createEntity(ArrayNode entities) throws AtlasServiceException { LOG.debug("Creating entities: {}", entities); ObjectNode response = callAPIWithBody(API_V1.CREATE_ENTITY, entities.toString()); List<String> results = extractEntityResult(response).getCreatedEntities(); LOG.debug("Create entities returned results: {}", results); return results; }