metrics.dataSetSearched++; final AtlasEntity.AtlasEntityWithExtInfo refExt = atlasClient.searchEntityDef(new AtlasObjectId(guid, typeName)); final String qualifiedName = (String) refExt.getEntity().getAttribute(ATTR_QUALIFIED_NAME); typedQualifiedNameToRef.put(toTypedQualifiedName(typeName, qualifiedName), new Referenceable(guid, typeName, Collections.EMPTY_MAP)); return qualifiedName;
final AtlasEntity.AtlasEntityWithExtInfo flowPathExt = atlasClient.searchEntityDef(new AtlasObjectId(TYPE_NIFI_FLOW_PATH, ATTR_QUALIFIED_NAME, flowPathQualifiedName)); final AtlasEntity flowPathEntity = flowPathExt.getEntity(); flowPathGuid = flowPathEntity.getGuid(); distinctInputs = toReferenceables(flowPathEntity.getAttribute(ATTR_INPUTS), metrics);
try { final AtlasEntity.AtlasEntityWithExtInfo entityExt = searchEntityDef(id); final AtlasEntity entity = entityExt.getEntity(); if (AtlasEntity.Status.DELETED.equals(entity.getStatus())) { return null;
private AtlasEntity getEntity(String guid) throws AtlasBaseException { if(guidEntityJsonMap.containsKey(guid)) { AtlasEntityWithExtInfo extInfo = getEntityWithExtInfo(guid); return (extInfo != null) ? extInfo.getEntity() : null; } return null; }
private AtlasEntity createInstance(AtlasEntity entity, String[] traitNames) throws Exception { AtlasEntity ret = null; EntityMutationResponse response = atlasClientV2.createEntity(new AtlasEntityWithExtInfo(entity)); List<AtlasEntityHeader> entities = response.getEntitiesByOperation(EntityOperation.CREATE); if (CollectionUtils.isNotEmpty(entities)) { AtlasEntityWithExtInfo getByGuidResponse = atlasClientV2.getEntityByGuid(entities.get(0).getGuid()); ret = getByGuidResponse.getEntity(); System.out.println("Created entity of type [" + ret.getTypeName() + "], guid: " + ret.getGuid()); } return ret; }
@Test public void transformEntityWithExtInfoNullCheck() throws AtlasBaseException { addColumnTransform(transform); AtlasEntityWithExtInfo entityWithExtInfo = getAtlasEntityWithExtInfo(); entityWithExtInfo.setReferredEntities(null); AtlasEntityWithExtInfo transformedEntityWithExtInfo = transform.apply(entityWithExtInfo); assertNotNull(transformedEntityWithExtInfo); assertEquals(entityWithExtInfo.getEntity().getGuid(), transformedEntityWithExtInfo.getEntity().getGuid()); }
@Override public AtlasGlossaryTerm from(final AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo) { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasGlossaryTermDTO.from()", entityWithExtInfo); } Objects.requireNonNull(entityWithExtInfo, "entityWithExtInfo"); AtlasGlossaryTerm ret = from(entityWithExtInfo.getEntity()); if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasGlossaryTermDTO.from() : {}", ret); } return ret; }
public Referenceable getReferenceable(AtlasEntity.AtlasEntityWithExtInfo entity) throws AtlasBaseException { AtlasFormatConverter.ConverterContext ctx = new AtlasFormatConverter.ConverterContext(); ctx.addEntity(entity.getEntity()); for(Map.Entry<String, AtlasEntity> entry : entity.getReferredEntities().entrySet()) { ctx.addEntity(entry.getValue()); } return getReferenceable(entity.getEntity(), ctx); }
private String getTableId(String tableName) throws AtlasServiceException { Map<String, String> attributes = new HashMap<>(); attributes.put(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, tableName); AtlasEntity tableEntity = atlasClientV2.getEntityByAttribute(TABLE_TYPE, attributes).getEntity(); return tableEntity.getGuid(); } }
private AtlasEntity getEntity(String entityName) throws AtlasBaseException { String entityGuid = entitiesMap.get(entityName); AtlasEntityWithExtInfo entityWithExtInfo = entityStore.getById(entityGuid); return entityWithExtInfo.getEntity(); }
@Test public void verifyCreate() throws AtlasBaseException { String expectedQualifiedName = getQualifiedName(expectedPath + "/", expectedClusterName); AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo = hdfsPathEntityCreator.getCreateEntity(expectedPath, expectedClusterName); assertNotNull(entityWithExtInfo); AtlasEntity entity = entityWithExtInfo.getEntity(); assertEquals(entity.getAttribute(HdfsPathEntityCreator.HDFS_PATH_ATTRIBUTE_NAME_PATH), expectedPath + "/"); assertEquals(entity.getAttribute(HDFS_PATH_ATTRIBUTE_QUALIFIED_NAME),expectedQualifiedName); assertEquals(entity.getAttribute(HDFS_PATH_ATTRIBUTE_NAME_NAME), expectedPath + "/"); assertEquals(entity.getAttribute(HDFS_PATH_ATTRIBUTE_NAME_CLUSTER_NAME), expectedClusterName); }
public AtlasEntity.AtlasEntityWithExtInfo apply(AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo) throws AtlasBaseException { if (entityWithExtInfo != null) { apply(entityWithExtInfo.getEntity()); if(MapUtils.isNotEmpty(entityWithExtInfo.getReferredEntities())) { for (AtlasEntity e : entityWithExtInfo.getReferredEntities().values()) { apply(e); } } } return entityWithExtInfo; }
@Override public AtlasGlossary from(final AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo) { if (LOG.isDebugEnabled()) { LOG.debug("==> AtlasGlossaryDTO.from()",entityWithExtInfo); } Objects.requireNonNull(entityWithExtInfo, "entity"); AtlasGlossary ret = from(entityWithExtInfo.getEntity()); if (LOG.isDebugEnabled()) { LOG.debug("<== AtlasGlossaryDTO.from() : {}", ret); } return ret; }
private void recordAddedEntityGuids(AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo) { guids.add(entityWithExtInfo.getEntity().getGuid()); if(entityWithExtInfo.getReferredEntities() != null) { guids.addAll(entityWithExtInfo.getReferredEntities().keySet()); } }
private AtlasEntity getStorageDescEntity(AtlasEntityWithExtInfo tableEntity) { AtlasEntity ret = null; if (tableEntity != null && tableEntity.getEntity() != null) { Object attrSdId = tableEntity.getEntity().getAttribute(ATTRIBUTE_STORAGEDESC); if (attrSdId instanceof AtlasObjectId) { ret = tableEntity.getReferredEntity(((AtlasObjectId) attrSdId).getGuid()); } } return ret; } }
private float updateImportMetrics(AtlasEntity.AtlasEntityWithExtInfo currentEntity, EntityMutationResponse resp, AtlasImportResult importResult, Set<String> processedGuids, int currentIndex, int streamSize, float currentPercent) { updateImportMetrics("entity:%s:created", resp.getCreatedEntities(), processedGuids, importResult); updateImportMetrics("entity:%s:updated", resp.getUpdatedEntities(), processedGuids, importResult); updateImportMetrics("entity:%s:deleted", resp.getDeletedEntities(), processedGuids, importResult); String lastEntityImported = String.format("entity:last-imported:%s:[%s]:(%s)", currentEntity.getEntity().getTypeName(), currentIndex, currentEntity.getEntity().getGuid()); return updateImportProgress(LOG, currentIndex, streamSize, currentPercent, lastEntityImported); }
private void clearRelationshipAttributes(AtlasEntityWithExtInfo entity) { if (entity != null) { clearRelationshipAttributes(entity.getEntity()); if (entity.getReferredEntities() != null) { clearRelationshipAttributes(entity.getReferredEntities().values()); } } }
public void add(AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo) throws AtlasBaseException { String jsonData = convertToJSON(entityWithExtInfo); saveToZip(entityWithExtInfo.getEntity().getGuid(), jsonData); recordAddedEntityGuids(entityWithExtInfo); }
final AtlasEntity.AtlasEntityWithExtInfo nifiFlowExt = searchEntityDef(flowId); if (nifiFlowExt == null || nifiFlowExt.getEntity() == null) { return null; final AtlasEntity nifiFlowEntity = nifiFlowExt.getEntity(); final Map<String, Object> attributes = nifiFlowEntity.getAttributes(); final NiFiFlow nifiFlow = new NiFiFlow(rootProcessGroupId);