@Override public String toString() { return AtlasType.toV1Json(this); }
@Override public String toString() { return AtlasType.toV1Json(this); }
@JsonIgnore public String getEntityDefinitionString() { if (entityDefinition != null) { return AtlasType.toV1Json(entityDefinition); } return null; }
@JsonIgnore public String getEntityDefinitionString() { if (entityDefinition != null) { return AtlasType.toV1Json(entityDefinition); } return null; }
/** * Register the given type(meta model) * @param typeDef type definition * @return result json object * @throws AtlasServiceException */ public List<String> createType(TypesDef typeDef) throws AtlasServiceException { return createType(AtlasType.toV1Json(typeDef)); }
/** * Register the given type(meta model) * @param typeDef type definition * @return result json object * @throws AtlasServiceException */ public List<String> createType(TypesDef typeDef) throws AtlasServiceException { return createType(AtlasType.toV1Json(typeDef)); }
private ArrayNode getEntitiesArray(Collection<Referenceable> entities) { ArrayNode entityArray = AtlasJson.createV1ArrayNode(); for (Referenceable entity : entities) { entityArray.add(AtlasType.toV1Json(entity)); } return entityArray; }
private ArrayNode getEntitiesArray(Collection<Referenceable> entities) { ArrayNode entityArray = AtlasJson.createV1ArrayNode(); for (Referenceable entity : entities) { entityArray.add(AtlasType.toV1Json(entity)); } return entityArray; }
/** * 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); }
/** * Register the given type(meta model) * @param typeDef type definition * @return result json object * @throws AtlasServiceException */ public List<String> updateType(TypesDef typeDef) throws AtlasServiceException { return updateType(AtlasType.toV1Json(typeDef)); }
/** * Register the given type(meta model) * @param typeDef type definition * @return result json object * @throws AtlasServiceException */ public List<String> updateType(TypesDef typeDef) throws AtlasServiceException { return updateType(AtlasType.toV1Json(typeDef)); }
public static String getMessageJson(Object message) { AtlasNotificationMessage<?> notificationMsg = new AtlasNotificationMessage<>(CURRENT_MESSAGE_VERSION, message); return AtlasType.toV1Json(notificationMsg); }
/** * Creates trait type with specifiedName, superTraits and attributes * @param traitName the name of the trait type * @param superTraits the list of super traits from which this trait type inherits attributes * @param attributeDefinitions the list of attributes of the trait type * @return the list of types created * @throws AtlasServiceException */ public List<String> createTraitType(String traitName, Set<String> superTraits, AttributeDefinition... attributeDefinitions) throws AtlasServiceException { TraitTypeDefinition piiTrait = TypesUtil.createTraitTypeDef(traitName, null, superTraits, Arrays.asList(attributeDefinitions)); TypesDef typesDef = new TypesDef(Collections.emptyList(), Collections.emptyList(), Collections.singletonList(piiTrait), Collections.emptyList()); LOG.debug("Creating trait type {} {}", traitName, AtlasType.toV1Json(piiTrait)); return createType(AtlasType.toV1Json(typesDef)); }
/** * 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 = AtlasType.toV1Json(entity); LOG.debug("Updating entity id {} with {}", guid, entityJson); ObjectNode response = callAPIWithBodyAndParams(API_V1.UPDATE_ENTITY_PARTIAL, entityJson, guid); return extractEntityResult(response); }
@Override public void onTraitsAdded(Referenceable entity, Collection<? extends Struct> traits) throws AtlasException { if (traits != null) { for (Struct trait : traits) { EntityAuditEvent event = createEvent(entity, EntityAuditAction.TAG_ADD, "Added trait: " + AtlasType.toV1Json(trait)); auditRepository.putEventsV1(event); } } }
@Override public void onTraitsUpdated(Referenceable entity, Collection<? extends Struct> traits) throws AtlasException { if (traits != null) { for (Struct trait : traits) { EntityAuditEvent event = createEvent(entity, EntityAuditAction.TAG_UPDATE, "Updated trait: " + AtlasType.toV1Json(trait)); auditRepository.putEventsV1(event); } } }
private Id createInstance(Referenceable referenceable) throws Exception { String typeName = referenceable.getTypeName(); String entityJSON = AtlasType.toV1Json(referenceable); System.out.println("Submitting new entity= " + entityJSON); List<String> guids = metadataServiceClient.createEntity(entityJSON); System.out.println("created instance for type " + typeName + ", guid: " + guids); // return the Id for created instance with guid if (guids.size() > 0) { return new Id(guids.get(guids.size() - 1), referenceable.getId().getVersion(), referenceable.getTypeName()); } return null; }
void createTypes() throws Exception { TypesDef typesDef = createTypeDefinitions(); String typesAsJSON = AtlasType.toV1Json(typesDef); System.out.println("typesAsJSON = " + typesAsJSON); metadataServiceClient.createType(typesAsJSON); // verify types created verifyTypesCreated(); }