use of org.apache.atlas.model.instance.AtlasEntity in project incubator-atlas by apache.
the class QuickStartV2 method createStorageDescriptor.
AtlasEntity createStorageDescriptor(String location, String inputFormat, String outputFormat, boolean compressed) throws Exception {
AtlasEntity entity = new AtlasEntity(STORAGE_DESC_TYPE);
entity.setAttribute("location", location);
entity.setAttribute("inputFormat", inputFormat);
entity.setAttribute("outputFormat", outputFormat);
entity.setAttribute("compressed", compressed);
return createInstance(entity, null);
}
use of org.apache.atlas.model.instance.AtlasEntity in project incubator-atlas by apache.
the class QuickStartV2 method createColumn.
AtlasEntity createColumn(String name, String dataType, String comment, String... traitNames) throws Exception {
AtlasEntity entity = new AtlasEntity(COLUMN_TYPE);
entity.setClassifications(toAtlasClassifications(traitNames));
entity.setAttribute("name", name);
entity.setAttribute("dataType", dataType);
entity.setAttribute("comment", comment);
return createInstance(entity, traitNames);
}
use of org.apache.atlas.model.instance.AtlasEntity in project incubator-atlas by apache.
the class QuickStartV2 method createProcess.
AtlasEntity createProcess(String name, String description, String user, List<AtlasEntity> inputs, List<AtlasEntity> outputs, String queryText, String queryPlan, String queryId, String queryGraph, String... traitNames) throws Exception {
AtlasEntity entity = new AtlasEntity(LOAD_PROCESS_TYPE);
entity.setClassifications(toAtlasClassifications(traitNames));
entity.setAttribute(AtlasClient.NAME, name);
entity.setAttribute(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, name);
entity.setAttribute("description", description);
entity.setAttribute("inputs", inputs);
entity.setAttribute("outputs", outputs);
entity.setAttribute("user", user);
entity.setAttribute("startTime", System.currentTimeMillis());
entity.setAttribute("endTime", System.currentTimeMillis() + 10000);
entity.setAttribute("queryText", queryText);
entity.setAttribute("queryPlan", queryPlan);
entity.setAttribute("queryId", queryId);
entity.setAttribute("queryGraph", queryGraph);
return createInstance(entity, traitNames);
}
use of org.apache.atlas.model.instance.AtlasEntity in project incubator-atlas by apache.
the class QuickStartV2 method createTable.
AtlasEntity createTable(String name, String description, AtlasEntity db, AtlasEntity sd, String owner, String tableType, List<AtlasEntity> columns, String... traitNames) throws Exception {
AtlasEntity entity = new AtlasEntity(TABLE_TYPE);
entity.setClassifications(toAtlasClassifications(traitNames));
entity.setAttribute("name", name);
entity.setAttribute(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, name);
entity.setAttribute("description", description);
entity.setAttribute("owner", owner);
entity.setAttribute("tableType", tableType);
entity.setAttribute("createTime", System.currentTimeMillis());
entity.setAttribute("lastAccessTime", System.currentTimeMillis());
entity.setAttribute("retention", System.currentTimeMillis());
entity.setAttribute("db", AtlasTypeUtil.getAtlasObjectId(db));
entity.setAttribute("sd", AtlasTypeUtil.getAtlasObjectId(sd));
entity.setAttribute("columns", AtlasTypeUtil.toObjectIds(columns));
return createInstance(entity, traitNames);
}
use of org.apache.atlas.model.instance.AtlasEntity in project incubator-atlas by apache.
the class BaseResourceIT method createHiveTableInstanceV2.
protected AtlasEntity createHiveTableInstanceV2(AtlasEntity databaseInstance, String tableName) throws Exception {
AtlasEntity tableInstance = new AtlasEntity(HIVE_TABLE_TYPE_V2);
tableInstance.setClassifications(Arrays.asList(new AtlasClassification("classification"), new AtlasClassification("pii"), new AtlasClassification("phi"), new AtlasClassification("pci"), new AtlasClassification("sox"), new AtlasClassification("sec"), new AtlasClassification("finance")));
tableInstance.setAttribute(NAME, tableName);
tableInstance.setAttribute(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, tableName);
tableInstance.setAttribute("db", AtlasTypeUtil.getAtlasObjectId(databaseInstance));
tableInstance.setAttribute(DESCRIPTION, "bar table");
tableInstance.setAttribute("lastAccessTime", "2014-07-11T08:00:00.000Z");
tableInstance.setAttribute("type", "managed");
tableInstance.setAttribute("level", 2);
// enum
tableInstance.setAttribute("tableType", "MANAGED");
tableInstance.setAttribute("compressed", false);
AtlasClassification classification = tableInstance.getClassifications().get(0);
classification.setAttribute("tag", "foundation_etl");
AtlasStruct serde1Instance = new AtlasStruct("serdeType");
serde1Instance.setAttribute(NAME, "serde1");
serde1Instance.setAttribute("serde", "serde1");
tableInstance.setAttribute("serde1", serde1Instance);
AtlasStruct serde2Instance = new AtlasStruct("serdeType");
serde2Instance.setAttribute(NAME, "serde2");
serde2Instance.setAttribute("serde", "serde2");
tableInstance.setAttribute("serde2", serde2Instance);
List<AtlasClassification> traits = tableInstance.getClassifications();
Assert.assertEquals(traits.size(), 7);
return tableInstance;
}
Aggregations