/** * Delete a trait from the given entity * @param guid guid of the entity * @param traitName trait to be deleted * @throws AtlasServiceException */ public void deleteTrait(String guid, String traitName) throws AtlasServiceException { callAPIWithBodyAndParams(API.DELETE_TRAITS, null, guid, TRAITS, traitName); }
/** * Delete a trait from the given entity * @param guid guid of the entity * @param traitName trait to be deleted * @throws AtlasServiceException */ public void deleteTrait(String guid, String traitName) throws AtlasServiceException { callAPIWithBodyAndParams(API_V1.DELETE_TRAITS, null, guid, TRAITS, traitName); }
/** * Delete a trait from the given entity * @param guid guid of the entity * @param traitName trait to be deleted * @throws AtlasServiceException */ public void deleteTrait(String guid, String traitName) throws AtlasServiceException { callAPIWithBodyAndParams(API_V1.DELETE_TRAITS, null, guid, TRAITS, traitName); }
/** * List traits for a given entity identified by its GUID * @param guid GUID of the entity * @return List<String> - traitnames associated with entity * @throws AtlasServiceException */ public List<String> listTraits(final String guid) throws AtlasServiceException { ObjectNode jsonResponse = callAPIWithBodyAndParams(API_V1.LIST_TRAITS, null, guid, URI_TRAITS); return extractStringList(jsonResponse); }
/** * List traits for a given entity identified by its GUID * @param guid GUID of the entity * @return List<String> - traitnames associated with entity * @throws AtlasServiceException */ public List<String> listTraits(final String guid) throws AtlasServiceException { ObjectNode jsonResponse = callAPIWithBodyAndParams(API_V1.LIST_TRAITS, null, guid, URI_TRAITS); return extractStringList(jsonResponse); }
/** * Associate trait to an entity * * @param guid guid * @param traitDefinition trait definition */ public void addTrait(String guid, Struct traitDefinition) throws AtlasServiceException { String traitJson = AtlasType.toV1Json(traitDefinition); LOG.debug("Adding trait to entity with id {} {}", guid, traitJson); callAPIWithBodyAndParams(API_V1.ADD_TRAITS, traitJson, guid, URI_TRAITS); }
/** * Associate trait to an entity * * @param guid guid * @param traitDefinition trait definition */ public void addTrait(String guid, Struct traitDefinition) throws AtlasServiceException { String traitJson = AtlasType.toV1Json(traitDefinition); LOG.debug("Adding trait to entity with id {} {}", guid, traitJson); callAPIWithBodyAndParams(API_V1.ADD_TRAITS, traitJson, guid, URI_TRAITS); }
/** * Associate trait to an entity * * @param guid guid * @param traitDefinition trait definition */ public void addTrait(String guid, Struct traitDefinition) throws AtlasServiceException { String traitJson = InstanceSerialization.toJson(traitDefinition, true); LOG.debug("Adding trait to entity with id {} {}", guid, traitJson); callAPIWithBodyAndParams(API.ADD_TRAITS, traitJson, guid, URI_TRAITS); }
/** * Get an entity given the entity id * @param guid entity id * @return result object * @throws AtlasServiceException */ public Referenceable getEntity(String guid) throws AtlasServiceException { ObjectNode jsonResponse = callAPIWithBodyAndParams(API_V1.GET_ENTITY, null, guid); String entityInstanceDefinition = AtlasType.toJson(jsonResponse.get(AtlasClient.DEFINITION)); return AtlasType.fromV1Json(entityInstanceDefinition, Referenceable.class); }
/** * Get trait definition for a given entity and traitname * @param guid GUID of the entity * @param traitName * @return trait definition * @throws AtlasServiceException */ public Struct getTraitDefinition(final String guid, final String traitName) throws AtlasServiceException { ObjectNode jsonResponse = callAPIWithBodyAndParams(API_V1.GET_TRAIT_DEFINITION, null, guid, TRAIT_DEFINITIONS, traitName); return AtlasType.fromV1Json(AtlasType.toJson(jsonResponse.get(AtlasClient.RESULTS)), Struct.class); }
/** * 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); }
/** * Get trait definition for a given entity and traitname * @param guid GUID of the entity * @param traitName * @return trait definition * @throws AtlasServiceException */ public Struct getTraitDefinition(final String guid, final String traitName) throws AtlasServiceException { ObjectNode jsonResponse = callAPIWithBodyAndParams(API_V1.GET_TRAIT_DEFINITION, null, guid, TRAIT_DEFINITIONS, traitName); return AtlasType.fromV1Json(AtlasType.toJson(jsonResponse.get(AtlasClient.RESULTS)), Struct.class); }
public TypesDef getType(String typeName) throws AtlasServiceException { ObjectNode response = callAPIWithBodyAndParams(API_V1.GET_TYPE, null, typeName); String typeJson = AtlasType.toJson(response.get(DEFINITION)); return AtlasType.fromV1Json(typeJson, TypesDef.class); }
/** * Get an entity given the entity id * @param guid entity id * @return result object * @throws AtlasServiceException */ public Referenceable getEntity(String guid) throws AtlasServiceException { ObjectNode jsonResponse = callAPIWithBodyAndParams(API_V1.GET_ENTITY, null, guid); String entityInstanceDefinition = AtlasType.toJson(jsonResponse.get(AtlasClient.DEFINITION)); return AtlasType.fromV1Json(entityInstanceDefinition, Referenceable.class); }
public TypesDef getType(String typeName) throws AtlasServiceException { ObjectNode response = callAPIWithBodyAndParams(API_V1.GET_TYPE, null, typeName); String typeJson = AtlasType.toJson(response.get(DEFINITION)); return AtlasType.fromV1Json(typeJson, TypesDef.class); }
/** * 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); }
/** * List traits for a given entity identified by its GUID * @param guid GUID of the entity * @return List<String> - traitnames associated with entity * @throws AtlasServiceException */ public List<String> listTraits(final String guid) throws AtlasServiceException { JSONObject jsonResponse = callAPIWithBodyAndParams(API.LIST_TRAITS, null, guid, URI_TRAITS); return extractResults(jsonResponse, AtlasClient.RESULTS, new ExtractOperation<String, String>()); }
public JSONObject getOutputGraph(String datasetName) throws AtlasServiceException { JSONObject response = callAPIWithBodyAndParams(API.NAME_LINEAGE_OUTPUTS_GRAPH, null, datasetName, "/outputs/graph"); try { return response.getJSONObject(AtlasClient.RESULTS); } catch (JSONException e) { throw new AtlasServiceException(e); } }
public JSONObject getInputGraph(String datasetName) throws AtlasServiceException { JSONObject response = callAPIWithBodyAndParams(API.NAME_LINEAGE_INPUTS_GRAPH, null, datasetName, "/inputs/graph"); try { return response.getJSONObject(AtlasClient.RESULTS); } catch (JSONException e) { throw new AtlasServiceException(e); } }
public TypesDef getType(String typeName) throws AtlasServiceException { try { JSONObject response = callAPIWithBodyAndParams(API.GET_TYPE, null, typeName); String typeJson = response.getString(DEFINITION); return TypesSerialization.fromJson(typeJson); } catch (JSONException e) { throw new AtlasServiceException(e); } }