当前位置: 首页>>代码示例>>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;未经允许,请勿转载。