protected EntityResult updateEntities(ArrayNode entities) throws AtlasServiceException { LOG.debug("Updating entities: {}", entities); ObjectNode response = callAPIWithBody(API_V1.UPDATE_ENTITY, entities.toString()); EntityResult results = extractEntityResult(response); LOG.debug("Update entities returned results: {}", results); return results; }
protected EntityResult updateEntities(ArrayNode entities) throws AtlasServiceException { LOG.debug("Updating entities: {}", entities); ObjectNode response = callAPIWithBody(API_V1.UPDATE_ENTITY, entities.toString()); EntityResult results = extractEntityResult(response); LOG.debug("Update entities returned results: {}", results); return results; }
protected EntityResult updateEntities(JSONArray entities) throws AtlasServiceException { LOG.debug("Updating entities: {}", entities); JSONObject response = callAPIWithBody(API.UPDATE_ENTITY, entities.toString()); EntityResult results = extractEntityResult(response); LOG.debug("Update entities returned results: {}", results); return results; }
/** * Supports Partial updates * Updates property for the entity corresponding to guid * @param guid guid * @param attribute property key * @param value property value */ public EntityResult updateEntityAttribute(final String guid, final String attribute, String value) throws AtlasServiceException { LOG.debug("Updating entity id: {}, attribute name: {}, attribute value: {}", guid, attribute, value); final API api = API_V1.UPDATE_ENTITY_PARTIAL; ObjectNode response = callAPIWithRetries(api, value, new ResourceCreator() { @Override public WebResource createResource() { WebResource resource = getResource(api, guid); resource = resource.queryParam(ATTRIBUTE_NAME, attribute); return resource; } }); return extractEntityResult(response); }
/** * Supports Partial updates * Updates property for the entity corresponding to guid * @param guid guid * @param attribute property key * @param value property value */ public EntityResult updateEntityAttribute(final String guid, final String attribute, String value) throws AtlasServiceException { LOG.debug("Updating entity id: {}, attribute name: {}, attribute value: {}", guid, attribute, value); final API api = API_V1.UPDATE_ENTITY_PARTIAL; ObjectNode response = callAPIWithRetries(api, value, new ResourceCreator() { @Override public WebResource createResource() { WebResource resource = getResource(api, guid); resource = resource.queryParam(ATTRIBUTE_NAME, attribute); return resource; } }); return extractEntityResult(response); }
/** * Supports Partial updates * Updates property for the entity corresponding to guid * @param guid guid * @param attribute property key * @param value property value */ public EntityResult updateEntityAttribute(final String guid, final String attribute, String value) throws AtlasServiceException { LOG.debug("Updating entity id: {}, attribute name: {}, attribute value: {}", guid, attribute, value); JSONObject response = callAPIWithRetries(API.UPDATE_ENTITY_PARTIAL, value, new ResourceCreator() { @Override public WebResource createResource() { API api = API.UPDATE_ENTITY_PARTIAL; WebResource resource = getResource(api, guid); resource = resource.queryParam(ATTRIBUTE_NAME, attribute); return resource; } }); return extractEntityResult(response); }
/** * Supports Partial updates * Updates properties set in the definition for the entity corresponding to guid * @param guid guid * @param entity entity definition */ public EntityResult updateEntity(String guid, Referenceable entity) throws AtlasServiceException { String entityJson = AtlasType.toV1Json(entity); LOG.debug("Updating entity id {} with {}", guid, entityJson); ObjectNode response = callAPIWithBodyAndParams(API_V1.UPDATE_ENTITY_PARTIAL, entityJson, guid); return extractEntityResult(response); }
/** * Supports Partial updates * Updates properties set in the definition for the entity corresponding to guid * @param guid guid * @param entity entity definition */ public EntityResult updateEntity(String guid, Referenceable entity) throws AtlasServiceException { String entityJson = InstanceSerialization.toJson(entity, true); LOG.debug("Updating entity id {} with {}", guid, entityJson); JSONObject response = callAPIWithBodyAndParams(API.UPDATE_ENTITY_PARTIAL, entityJson, guid); return extractEntityResult(response); }
/** * Delete the specified entities from the repository * * @param guids guids of entities to delete * @return List of entity ids updated/deleted * @throws AtlasServiceException */ public EntityResult deleteEntities(final String... guids) throws AtlasServiceException { LOG.debug("Deleting entities: {}", guids); final API api = API_V1.DELETE_ENTITIES; ObjectNode jsonResponse = callAPIWithRetries(api, null, new ResourceCreator() { @Override public WebResource createResource() { WebResource resource = getResource(api); for (String guid : guids) { resource = resource.queryParam(GUID.toLowerCase(), guid); } return resource; } }); EntityResult results = extractEntityResult(jsonResponse); LOG.debug("Delete entities returned results: {}", results); return results; }
/** * Supports Partial updates * Updates properties set in the definition for the entity corresponding to guid * @param guid guid * @param entity entity definition */ public EntityResult updateEntity(String guid, Referenceable entity) throws AtlasServiceException { String entityJson = AtlasType.toV1Json(entity); LOG.debug("Updating entity id {} with {}", guid, entityJson); ObjectNode response = callAPIWithBodyAndParams(API_V1.UPDATE_ENTITY_PARTIAL, entityJson, guid); return extractEntityResult(response); }
/** * Delete the specified entities from the repository * * @param guids guids of entities to delete * @return List of entity ids updated/deleted * @throws AtlasServiceException */ public EntityResult deleteEntities(final String... guids) throws AtlasServiceException { LOG.debug("Deleting entities: {}", guids); final API api = API_V1.DELETE_ENTITIES; ObjectNode jsonResponse = callAPIWithRetries(api, null, new ResourceCreator() { @Override public WebResource createResource() { WebResource resource = getResource(api); for (String guid : guids) { resource = resource.queryParam(GUID.toLowerCase(), guid); } return resource; } }); EntityResult results = extractEntityResult(jsonResponse); LOG.debug("Delete entities returned results: {}", results); return results; }
/** * Delete the specified entities from the repository * * @param guids guids of entities to delete * @return List of entity ids updated/deleted * @throws AtlasServiceException */ public EntityResult deleteEntities(final String ... guids) throws AtlasServiceException { LOG.debug("Deleting entities: {}", guids); JSONObject jsonResponse = callAPIWithRetries(API.DELETE_ENTITIES, null, new ResourceCreator() { @Override public WebResource createResource() { API api = API.DELETE_ENTITIES; WebResource resource = getResource(api); for (String guid : guids) { resource = resource.queryParam(GUID.toLowerCase(), guid); } return resource; } }); EntityResult results = extractEntityResult(jsonResponse); LOG.debug("Delete entities returned results: {}", results); return results; }
/** * 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; }
/** * 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; }
/** * Create the given entity * @param entities entity(type instance) as json * @return json array of guids * @throws AtlasServiceException */ protected List<String> createEntity(JSONArray entities) throws AtlasServiceException { LOG.debug("Creating entities: {}", entities); JSONObject response = callAPIWithBody(API.CREATE_ENTITY, entities.toString()); List<String> results = extractEntityResult(response).getCreatedEntities(); LOG.debug("Create entities returned results: {}", results); return results; }
/** * Supports Partial updates * Updates properties set in the definition for the entity corresponding to guid * @param entityType Type of the entity being updated * @param uniqueAttributeName Attribute Name that uniquely identifies the entity * @param uniqueAttributeValue Attribute Value that uniquely identifies the entity * @param entity entity definition */ public EntityResult updateEntity(final String entityType, final String uniqueAttributeName, final String uniqueAttributeValue, Referenceable entity) throws AtlasServiceException { final API api = API.UPDATE_ENTITY_PARTIAL; String entityJson = InstanceSerialization.toJson(entity, true); LOG.debug("Updating entity type: {}, attributeName: {}, attributeValue: {}, entity: {}", entityType, uniqueAttributeName, uniqueAttributeValue, entityJson); JSONObject response = callAPIWithRetries(api, entityJson, new ResourceCreator() { @Override public WebResource createResource() { WebResource resource = getResource(api, QUALIFIED_NAME); resource = resource.queryParam(TYPE, entityType); resource = resource.queryParam(ATTRIBUTE_NAME, uniqueAttributeName); resource = resource.queryParam(ATTRIBUTE_VALUE, uniqueAttributeValue); return resource; } }); EntityResult result = extractEntityResult(response); LOG.debug("Update entity returned result: {}", result); return result; }
/** * Supports Partial updates * Updates properties set in the definition for the entity corresponding to guid * @param entityType Type of the entity being updated * @param uniqueAttributeName Attribute Name that uniquely identifies the entity * @param uniqueAttributeValue Attribute Value that uniquely identifies the entity * @param entity entity definition */ public EntityResult updateEntity(final String entityType, final String uniqueAttributeName, final String uniqueAttributeValue, Referenceable entity) throws AtlasServiceException { final API api = API_V1.UPDATE_ENTITY_PARTIAL; String entityJson = AtlasType.toV1Json(entity); LOG.debug("Updating entity type: {}, attributeName: {}, attributeValue: {}, entity: {}", entityType, uniqueAttributeName, uniqueAttributeValue, entityJson); ObjectNode response = callAPIWithRetries(api, entityJson, new ResourceCreator() { @Override public WebResource createResource() { WebResource resource = getResource(api, QUALIFIED_NAME); resource = resource.queryParam(TYPE, entityType); resource = resource.queryParam(ATTRIBUTE_NAME, uniqueAttributeName); resource = resource.queryParam(ATTRIBUTE_VALUE, uniqueAttributeValue); return resource; } }); EntityResult result = extractEntityResult(response); LOG.debug("Update entity returned result: {}", result); return result; }
/** * Supports Deletion of an entity identified by its unique attribute value * @param entityType Type of the entity being deleted * @param uniqueAttributeName Attribute Name that uniquely identifies the entity * @param uniqueAttributeValue Attribute Value that uniquely identifies the entity * @return List of entity ids updated/deleted(including composite references from that entity) */ public EntityResult deleteEntity(String entityType, String uniqueAttributeName, String uniqueAttributeValue) throws AtlasServiceException { LOG.debug("Deleting entity type: {}, attributeName: {}, attributeValue: {}", entityType, uniqueAttributeName, uniqueAttributeValue); API api = API_V1.DELETE_ENTITIES; WebResource resource = getResource(api); resource = resource.queryParam(TYPE, entityType); resource = resource.queryParam(ATTRIBUTE_NAME, uniqueAttributeName); resource = resource.queryParam(ATTRIBUTE_VALUE, uniqueAttributeValue); ObjectNode jsonResponse = callAPIWithResource(api, resource); EntityResult results = extractEntityResult(jsonResponse); LOG.debug("Delete entities returned results: {}", results); return results; }
/** * Supports Deletion of an entity identified by its unique attribute value * @param entityType Type of the entity being deleted * @param uniqueAttributeName Attribute Name that uniquely identifies the entity * @param uniqueAttributeValue Attribute Value that uniquely identifies the entity * @return List of entity ids updated/deleted(including composite references from that entity) */ public EntityResult deleteEntity(String entityType, String uniqueAttributeName, String uniqueAttributeValue) throws AtlasServiceException { LOG.debug("Deleting entity type: {}, attributeName: {}, attributeValue: {}", entityType, uniqueAttributeName, uniqueAttributeValue); API api = API_V1.DELETE_ENTITIES; WebResource resource = getResource(api); resource = resource.queryParam(TYPE, entityType); resource = resource.queryParam(ATTRIBUTE_NAME, uniqueAttributeName); resource = resource.queryParam(ATTRIBUTE_VALUE, uniqueAttributeValue); ObjectNode jsonResponse = callAPIWithResource(api, resource); EntityResult results = extractEntityResult(jsonResponse); LOG.debug("Delete entities returned results: {}", results); return results; }
/** * Supports Deletion of an entity identified by its unique attribute value * @param entityType Type of the entity being deleted * @param uniqueAttributeName Attribute Name that uniquely identifies the entity * @param uniqueAttributeValue Attribute Value that uniquely identifies the entity * @return List of entity ids updated/deleted(including composite references from that entity) */ public EntityResult deleteEntity(String entityType, String uniqueAttributeName, String uniqueAttributeValue) throws AtlasServiceException { LOG.debug("Deleting entity type: {}, attributeName: {}, attributeValue: {}", entityType, uniqueAttributeName, uniqueAttributeValue); API api = API.DELETE_ENTITY; WebResource resource = getResource(api); resource = resource.queryParam(TYPE, entityType); resource = resource.queryParam(ATTRIBUTE_NAME, uniqueAttributeName); resource = resource.queryParam(ATTRIBUTE_VALUE, uniqueAttributeValue); JSONObject jsonResponse = callAPIWithResource(API.DELETE_ENTITIES, resource); EntityResult results = extractEntityResult(jsonResponse); LOG.debug("Delete entities returned results: {}", results); return results; }