當前位置: 首頁>>代碼示例>>Java>>正文


Java AtlasEntityHeader類代碼示例

本文整理匯總了Java中org.apache.atlas.model.instance.AtlasEntityHeader的典型用法代碼示例。如果您正苦於以下問題:Java AtlasEntityHeader類的具體用法?Java AtlasEntityHeader怎麽用?Java AtlasEntityHeader使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AtlasEntityHeader類屬於org.apache.atlas.model.instance包,在下文中一共展示了AtlasEntityHeader類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: search

import org.apache.atlas.model.instance.AtlasEntityHeader; //導入依賴的package包/類
private void search() throws Exception {
    System.out.println("\nSample DSL Queries: ");

    for (String dslQuery : getDSLQueries()) {
        AtlasSearchResult results = atlasClientV2.dslSearchWithParams(dslQuery, 10, 0);

        if (results != null) {
            List<AtlasEntityHeader>   entitiesResult  = results.getEntities();
            List<AtlasFullTextResult> fullTextResults = results.getFullTextResult();
            AttributeSearchResult     attribResult    = results.getAttributes();

            if (CollectionUtils.isNotEmpty(entitiesResult)) {
                System.out.println("query [" + dslQuery + "] returned [" + entitiesResult.size() + "] rows.");
            } else if (CollectionUtils.isNotEmpty(fullTextResults)) {
                System.out.println("query [" + dslQuery + "] returned [" + fullTextResults.size() + "] rows.");
            } else if (attribResult != null) {
                System.out.println("query [" + dslQuery + "] returned [" + attribResult.getValues().size() + "] rows.");
            }
        } else {
            System.out.println("query [" + dslQuery + "] failed, results:" + results);
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-atlas,代碼行數:24,代碼來源:QuickStartV2.java

示例2: modifyEntity

import org.apache.atlas.model.instance.AtlasEntityHeader; //導入依賴的package包/類
protected AtlasEntityHeader modifyEntity(AtlasEntity atlasEntity, boolean update) {
    EntityMutationResponse entity = null;
    try {
        if (!update) {
            entity = atlasClientV2.createEntity(new AtlasEntityWithExtInfo(atlasEntity));
            assertNotNull(entity);
            assertNotNull(entity.getEntitiesByOperation(EntityMutations.EntityOperation.CREATE));
            assertTrue(entity.getEntitiesByOperation(EntityMutations.EntityOperation.CREATE).size() > 0);
            return entity.getEntitiesByOperation(EntityMutations.EntityOperation.CREATE).get(0);
        } else {
            entity = atlasClientV2.updateEntity(new AtlasEntityWithExtInfo(atlasEntity));
            assertNotNull(entity);
            assertNotNull(entity.getEntitiesByOperation(EntityMutations.EntityOperation.UPDATE));
            assertTrue(entity.getEntitiesByOperation(EntityMutations.EntityOperation.UPDATE).size() > 0);
            return entity.getEntitiesByOperation(EntityMutations.EntityOperation.UPDATE).get(0);
        }

    } catch (AtlasServiceException e) {
        LOG.error("Entity {} failed", update ? "update" : "creation", entity);
    }
    return null;
}
 
開發者ID:apache,項目名稱:incubator-atlas,代碼行數:23,代碼來源:BaseResourceIT.java

示例3: testUTF8

import org.apache.atlas.model.instance.AtlasEntityHeader; //導入依賴的package包/類
@Test
public void testUTF8() throws Exception {
    String classType = randomString();
    String attrName = random();
    String attrValue = random();

    AtlasEntityDef classTypeDef = AtlasTypeUtil
            .createClassTypeDef(classType, ImmutableSet.<String>of(),
                    AtlasTypeUtil.createUniqueRequiredAttrDef(attrName, "string"));
    AtlasTypesDef atlasTypesDef = new AtlasTypesDef();
    atlasTypesDef.getEntityDefs().add(classTypeDef);
    createType(atlasTypesDef);

    AtlasEntity instance = new AtlasEntity(classType);
    instance.setAttribute(attrName, attrValue);
    AtlasEntityHeader entity = createEntity(instance);
    assertNotNull(entity);
    assertNotNull(entity.getGuid());

    AtlasEntity entityByGuid = getEntityByGuid(entity.getGuid());
    assertEquals(entityByGuid.getAttribute(attrName), attrValue);
}
 
開發者ID:apache,項目名稱:incubator-atlas,代碼行數:23,代碼來源:EntityV2JerseyResourceIT.java

示例4: testSearchByDSL

import org.apache.atlas.model.instance.AtlasEntityHeader; //導入依賴的package包/類
@Test
public void testSearchByDSL() throws Exception {
    String dslQuery = "from "+ DATABASE_TYPE_BUILTIN + " " + QUALIFIED_NAME + "=\"" + dbName + "\"";

    AtlasSearchResult searchResult = atlasClientV2.dslSearch(dslQuery);
    assertNotNull(searchResult);
    assertEquals(searchResult.getQueryText(), dslQuery);
    assertEquals(searchResult.getQueryType(), AtlasQueryType.DSL);

    List<AtlasEntityHeader> entities = searchResult.getEntities();
    assertNotNull(entities);
    assertEquals(entities.size(), 1);

    AtlasEntityHeader dbEntity = entities.get(0);
    assertEquals(dbEntity.getTypeName(), DATABASE_TYPE_BUILTIN);
    assertEquals(dbEntity.getDisplayText(), dbName);
    assertEquals(dbEntity.getStatus(), Status.ACTIVE);
    assertNotNull(dbEntity.getGuid());
    assertNull(searchResult.getAttributes());
    assertNull(searchResult.getFullTextResult());
}
 
開發者ID:apache,項目名稱:incubator-atlas,代碼行數:22,代碼來源:EntityDiscoveryJerseyResourceIT.java

示例5: testSearchUsingDSL

import org.apache.atlas.model.instance.AtlasEntityHeader; //導入依賴的package包/類
@Test
public void testSearchUsingDSL() throws Exception {
    String query = "from "+ DATABASE_TYPE_BUILTIN + " " + QUALIFIED_NAME + "=\"" + dbName + "\"";
    AtlasSearchResult searchResult = atlasClientV2.dslSearch(query);
    assertNotNull(searchResult);

    assertEquals(searchResult.getQueryText(), query);
    assertEquals(searchResult.getQueryType(), AtlasQueryType.DSL);
    List<AtlasEntityHeader> entities = searchResult.getEntities();
    assertNotNull(entities);
    assertEquals(entities.size(), 1);

    AtlasEntityHeader dbEntity = entities.get(0);
    assertEquals(dbEntity.getTypeName(), DATABASE_TYPE_BUILTIN);
    assertEquals(dbEntity.getDisplayText(), dbName);
    assertEquals(dbEntity.getStatus(), Status.ACTIVE);

    assertNotNull(dbEntity.getGuid());
    assertNull(searchResult.getAttributes());
    assertNull(searchResult.getFullTextResult());
}
 
開發者ID:apache,項目名稱:incubator-atlas,代碼行數:22,代碼來源:EntityDiscoveryJerseyResourceIT.java

示例6: testDeleteEntitiesDoesNotLookupDeletedEntity

import org.apache.atlas.model.instance.AtlasEntityHeader; //導入依賴的package包/類
@Test
public void testDeleteEntitiesDoesNotLookupDeletedEntity() throws Exception {
    List<String> guids = Collections.singletonList(DELETED_GUID);
    List<AtlasEntityHeader> deletedEntities = Collections.singletonList(new AtlasEntityHeader(null, DELETED_GUID, null));

    // Create EntityResult with a deleted guid and no other guids.
    EntityMutationResponse  resp    = new EntityMutationResponse();
    List<AtlasEntityHeader> headers = toAtlasEntityHeaders(guids);

    if (CollectionUtils.isNotEmpty(headers)) {
        for (AtlasEntityHeader entity : headers) {
            resp.addEntity(EntityMutations.EntityOperation.DELETE, entity);
        }
    }

    when(entitiesStore.deleteByIds(guids)).thenReturn(resp);

    EntityMutationResponse response = entitiesStore.deleteByIds(guids);

    List<AtlasEntityHeader> responseDeletedEntities = response.getDeletedEntities();

    Assert.assertEquals(responseDeletedEntities, deletedEntities);
}
 
開發者ID:apache,項目名稱:incubator-atlas,代碼行數:24,代碼來源:EntityResourceTest.java

示例7: testCreateOrUpdateEntities

import org.apache.atlas.model.instance.AtlasEntityHeader; //導入依賴的package包/類
@Test
public void testCreateOrUpdateEntities() throws Exception {
    AtlasEntitiesWithExtInfo entities = new AtlasEntitiesWithExtInfo();

    entities.addEntity(dbEntity);
    entities.addEntity(tableEntity);
    for (AtlasEntity column : columns) {
        entities.addReferredEntity(column);
    }

    EntityMutationResponse response = entityREST.createOrUpdate(entities);
    List<AtlasEntityHeader> guids = response.getEntitiesByOperation(EntityMutations.EntityOperation.CREATE);

    Assert.assertNotNull(guids);
    Assert.assertEquals(guids.size(), 3);

    for (AtlasEntityHeader header : guids) {
        createdGuids.add(header.getGuid());
    }
}
 
開發者ID:apache,項目名稱:incubator-atlas,代碼行數:21,代碼來源:TestEntitiesREST.java

示例8: testLineageIsMaintained

import org.apache.atlas.model.instance.AtlasEntityHeader; //導入依賴的package包/類
@Test
public void testLineageIsMaintained() throws AtlasServiceException, JSONException {
    String salesFactTableId      = getTableId(QuickStartV2.SALES_FACT_TABLE);
    String timeDimTableId        = getTableId(QuickStartV2.TIME_DIM_TABLE);
    String salesFactDailyMVId    = getTableId(QuickStartV2.SALES_FACT_DAILY_MV_TABLE);
    String salesFactMonthlyMvId  = getTableId(QuickStartV2.SALES_FACT_MONTHLY_MV_TABLE);
    String salesDailyProcessId   = getProcessId(QuickStartV2.LOAD_SALES_DAILY_PROCESS);
    String salesMonthlyProcessId = getProcessId(QuickStartV2.LOAD_SALES_MONTHLY_PROCESS);

    AtlasLineageInfo inputLineage = atlasClientV2.getLineageInfo(salesFactDailyMVId, LineageDirection.BOTH, 0);
    List<LineageRelation> relations = new ArrayList<>(inputLineage.getRelations());
    Map<String, AtlasEntityHeader> entityMap = inputLineage.getGuidEntityMap();

    assertEquals(relations.size(), 5);
    assertEquals(entityMap.size(), 6);

    assertTrue(entityMap.containsKey(salesFactTableId));
    assertTrue(entityMap.containsKey(timeDimTableId));
    assertTrue(entityMap.containsKey(salesFactDailyMVId));
    assertTrue(entityMap.containsKey(salesDailyProcessId));
    assertTrue(entityMap.containsKey(salesFactMonthlyMvId));
    assertTrue(entityMap.containsKey(salesMonthlyProcessId));
}
 
開發者ID:apache,項目名稱:incubator-atlas,代碼行數:24,代碼來源:QuickStartV2IT.java

示例9: getIndexQueryResults

import org.apache.atlas.model.instance.AtlasEntityHeader; //導入依賴的package包/類
private List<AtlasFullTextResult> getIndexQueryResults(AtlasIndexQuery query, QueryParams params, boolean excludeDeletedEntities) throws AtlasBaseException {
    List<AtlasFullTextResult> ret  = new ArrayList<>();
    Iterator<Result>          iter = query.vertices();

    while (iter.hasNext() && ret.size() < params.limit()) {
        Result      idxQueryResult = iter.next();
        AtlasVertex vertex         = idxQueryResult.getVertex();

        if (skipDeletedEntities(excludeDeletedEntities, vertex)) {
            continue;
        }

        String guid = vertex != null ? vertex.getProperty(Constants.GUID_PROPERTY_KEY, String.class) : null;

        if (guid != null) {
            AtlasEntityHeader entity = entityRetriever.toAtlasEntityHeader(vertex);
            Double score = idxQueryResult.getScore();
            ret.add(new AtlasFullTextResult(entity, score));
        }
    }

    return ret;
}
 
開發者ID:apache,項目名稱:incubator-atlas,代碼行數:24,代碼來源:EntityDiscoveryService.java

示例10: onEntitiesMutated

import org.apache.atlas.model.instance.AtlasEntityHeader; //導入依賴的package包/類
public void onEntitiesMutated(EntityMutationResponse entityMutationResponse, boolean isImport) throws AtlasBaseException {
    if (CollectionUtils.isEmpty(entityChangeListeners) || instanceConverter == null) {
        return;
    }

    List<AtlasEntityHeader> createdEntities          = entityMutationResponse.getCreatedEntities();
    List<AtlasEntityHeader> updatedEntities          = entityMutationResponse.getUpdatedEntities();
    List<AtlasEntityHeader> partiallyUpdatedEntities = entityMutationResponse.getPartialUpdatedEntities();
    List<AtlasEntityHeader> deletedEntities          = entityMutationResponse.getDeletedEntities();

    // complete full text mapping before calling toITypedReferenceable(), from notifyListners(), to
    // include all vertex updates in the current graph-transaction
    doFullTextMapping(createdEntities);
    doFullTextMapping(updatedEntities);
    doFullTextMapping(partiallyUpdatedEntities);

    notifyListeners(createdEntities, EntityOperation.CREATE, isImport);
    notifyListeners(updatedEntities, EntityOperation.UPDATE, isImport);
    notifyListeners(partiallyUpdatedEntities, EntityOperation.PARTIAL_UPDATE, isImport);
    notifyListeners(deletedEntities, EntityOperation.DELETE, isImport);
}
 
開發者ID:apache,項目名稱:incubator-atlas,代碼行數:22,代碼來源:AtlasEntityChangeNotifier.java

示例11: notifyListeners

import org.apache.atlas.model.instance.AtlasEntityHeader; //導入依賴的package包/類
private void notifyListeners(List<AtlasEntityHeader> entityHeaders, EntityOperation operation, boolean isImport) throws AtlasBaseException {
    if (CollectionUtils.isEmpty(entityHeaders)) {
        return;
    }

    List<ITypedReferenceableInstance> typedRefInsts = toITypedReferenceable(entityHeaders);

    for (EntityChangeListener listener : entityChangeListeners) {
        try {
            switch (operation) {
                case CREATE:
                    listener.onEntitiesAdded(typedRefInsts, isImport);
                    break;
                case UPDATE:
                case PARTIAL_UPDATE:
                    listener.onEntitiesUpdated(typedRefInsts, isImport);
                    break;
                case DELETE:
                    listener.onEntitiesDeleted(typedRefInsts, isImport);
                    break;
            }
        } catch (AtlasException e) {
            throw new AtlasBaseException(AtlasErrorCode.NOTIFICATION_FAILED, e, getListenerName(listener), operation.toString());
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-atlas,代碼行數:27,代碼來源:AtlasEntityChangeNotifier.java

示例12: testCircularLineage

import org.apache.atlas.model.instance.AtlasEntityHeader; //導入依賴的package包/類
/**
 * Circular Lineage Test.
 */
@Test
public void testCircularLineage() throws Exception{
    TestUtils.skipForGremlin3EnabledGraphDb();
    String entityGuid = getEntityId(HIVE_TABLE_TYPE, "name", "table2");
    AtlasLineageInfo circularLineage = getInputLineageInfo(entityGuid, 5);

    assertNotNull(circularLineage);
    System.out.println("circular lineage = " + circularLineage);

    Map<String, AtlasEntityHeader> entities = circularLineage.getGuidEntityMap();
    assertNotNull(entities);

    Set<LineageRelation> relations = circularLineage.getRelations();
    assertNotNull(relations);

    Assert.assertEquals(entities.size(), 4);
    Assert.assertEquals(relations.size(), 4);
    Assert.assertEquals(circularLineage.getLineageDepth(), 5);
    Assert.assertEquals(circularLineage.getLineageDirection(), LineageDirection.INPUT);

    assertTrue(entities.containsKey(circularLineage.getBaseEntityGuid()));
}
 
開發者ID:apache,項目名稱:incubator-atlas,代碼行數:26,代碼來源:EntityLineageServiceTest.java

示例13: testGetInputLineageInfo

import org.apache.atlas.model.instance.AtlasEntityHeader; //導入依賴的package包/類
@Test
public void testGetInputLineageInfo() throws Exception {
    TestUtils.skipForGremlin3EnabledGraphDb();
    String entityGuid = getEntityId(HIVE_TABLE_TYPE, "name", "sales_fact_monthly_mv");
    AtlasLineageInfo inputLineage = getInputLineageInfo(entityGuid, 4);

    assertNotNull(inputLineage);
    System.out.println("input lineage = " + inputLineage);

    Map<String, AtlasEntityHeader> entities = inputLineage.getGuidEntityMap();
    assertNotNull(entities);

    Set<LineageRelation> relations = inputLineage.getRelations();
    assertNotNull(relations);

    Assert.assertEquals(entities.size(), 6);
    Assert.assertEquals(relations.size(), 5);
    Assert.assertEquals(inputLineage.getLineageDepth(), 4);
    Assert.assertEquals(inputLineage.getLineageDirection(), LineageDirection.INPUT);

    assertTrue(entities.containsKey(inputLineage.getBaseEntityGuid()));
}
 
開發者ID:apache,項目名稱:incubator-atlas,代碼行數:23,代碼來源:EntityLineageServiceTest.java

示例14: testGetOutputLineageInfo

import org.apache.atlas.model.instance.AtlasEntityHeader; //導入依賴的package包/類
@Test
public void testGetOutputLineageInfo() throws Exception {
    TestUtils.skipForGremlin3EnabledGraphDb();
    String entityGuid = getEntityId(HIVE_TABLE_TYPE, "name", "sales_fact");
    AtlasLineageInfo outputLineage = getOutputLineageInfo(entityGuid, 4);

    assertNotNull(outputLineage);
    System.out.println("output lineage = " + outputLineage);

    Map<String, AtlasEntityHeader> entities = outputLineage.getGuidEntityMap();
    assertNotNull(entities);

    Set<LineageRelation> relations = outputLineage.getRelations();
    assertNotNull(relations);

    Assert.assertEquals(entities.size(), 5);
    Assert.assertEquals(relations.size(), 4);
    Assert.assertEquals(outputLineage.getLineageDepth(), 4);
    Assert.assertEquals(outputLineage.getLineageDirection(), LineageDirection.OUTPUT);

    assertTrue(entities.containsKey(outputLineage.getBaseEntityGuid()));
}
 
開發者ID:apache,項目名稱:incubator-atlas,代碼行數:23,代碼來源:EntityLineageServiceTest.java

示例15: testGetLineageInfo

import org.apache.atlas.model.instance.AtlasEntityHeader; //導入依賴的package包/類
@Test
public void testGetLineageInfo() throws Exception {
    TestUtils.skipForGremlin3EnabledGraphDb();
    String entityGuid = getEntityId(HIVE_TABLE_TYPE, "name", "sales_fact_monthly_mv");
    AtlasLineageInfo bothLineage = getBothLineageInfo(entityGuid, 5);

    assertNotNull(bothLineage);
    System.out.println("both lineage = " + bothLineage);

    Map<String, AtlasEntityHeader> entities = bothLineage.getGuidEntityMap();
    assertNotNull(entities);

    Set<LineageRelation> relations = bothLineage.getRelations();
    assertNotNull(relations);

    Assert.assertEquals(entities.size(), 6);
    Assert.assertEquals(relations.size(), 5);
    Assert.assertEquals(bothLineage.getLineageDepth(), 5);
    Assert.assertEquals(bothLineage.getLineageDirection(), AtlasLineageInfo.LineageDirection.BOTH);

    assertTrue(entities.containsKey(bothLineage.getBaseEntityGuid()));
}
 
開發者ID:apache,項目名稱:incubator-atlas,代碼行數:23,代碼來源:EntityLineageServiceTest.java


注:本文中的org.apache.atlas.model.instance.AtlasEntityHeader類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。