use of org.apache.atlas.model.typedef.AtlasBusinessMetadataDef in project atlas by apache.
the class TypeDefExample method createBusinessMetadataDefs.
private List<AtlasBusinessMetadataDef> createBusinessMetadataDefs() {
String description = "description";
Map<String, String> options = new HashMap<>();
options.put("maxStrLength", "20");
options.put("applicableEntityTypes", "[\"" + SampleAppConstants.DATABASE_TYPE + "\",\"" + SampleAppConstants.TABLE_TYPE + "\"]");
AtlasBusinessMetadataDef bmWithAllTypes = createBusinessMetadataDef(SampleAppConstants.BUSINESS_METADATA_TYPE, description, "1.0", createOptionalAttrDef(ATTR_ATTR1, ATLAS_TYPE_BOOLEAN, options, description), createOptionalAttrDef(ATTR_ATTR2, ATLAS_TYPE_BYTE, options, description), createOptionalAttrDef(ATTR_ATTR8, ATLAS_TYPE_STRING, options, description));
AtlasBusinessMetadataDef bmWithAllTypesMV = createBusinessMetadataDef(SampleAppConstants.BUSINESS_METADATA_TYPE_MV, description, "1.0", createOptionalAttrDef(ATTR_ATTR11, "array<boolean>", options, description), createOptionalAttrDef(ATTR_ATTR18, "array<string>", options, description));
return Arrays.asList(bmWithAllTypes, bmWithAllTypesMV);
}
use of org.apache.atlas.model.typedef.AtlasBusinessMetadataDef in project atlas by apache.
the class TypeDefExample method createTypeDefinitions.
public void createTypeDefinitions() throws Exception {
AtlasEntityDef databaseDef = createDatabaseDef();
AtlasEntityDef tableDef = createTableDef();
AtlasEntityDef columnDef = createColumnDef();
AtlasEntityDef processDef = createProcessDef();
AtlasStructDef serDeDef = createSerDeDef();
AtlasEnumDef tableTypeDef = createTableTypeEnumDef();
List<AtlasClassificationDef> classificationDefs = createClassificationDefs();
List<AtlasBusinessMetadataDef> businessMetadataDef = createBusinessMetadataDefs();
List<AtlasRelationshipDef> relationshipDefs = createAtlasRelationshipDef();
AtlasTypesDef typesDef = new AtlasTypesDef(Collections.singletonList(tableTypeDef), Collections.singletonList(serDeDef), classificationDefs, Arrays.asList(databaseDef, tableDef, columnDef, processDef), relationshipDefs, businessMetadataDef);
this.typesDef = batchCreateTypes(typesDef);
}
use of org.apache.atlas.model.typedef.AtlasBusinessMetadataDef in project atlas by apache.
the class ExportService method processTypesDef.
private void processTypesDef(ExportContext context) {
AtlasTypesDef typesDef = context.result.getData().getTypesDef();
for (String entityType : context.entityTypes) {
AtlasEntityDef entityDef = typeRegistry.getEntityDefByName(entityType);
typesDef.getEntityDefs().add(entityDef);
}
for (String classificationType : context.classificationTypes) {
AtlasClassificationDef classificationDef = typeRegistry.getClassificationDefByName(classificationType);
typesDef.getClassificationDefs().add(classificationDef);
}
for (String structType : context.structTypes) {
AtlasStructDef structDef = typeRegistry.getStructDefByName(structType);
typesDef.getStructDefs().add(structDef);
}
for (String enumType : context.enumTypes) {
AtlasEnumDef enumDef = typeRegistry.getEnumDefByName(enumType);
typesDef.getEnumDefs().add(enumDef);
}
for (String relationshipType : context.relationshipTypes) {
AtlasRelationshipDef relationshipDef = typeRegistry.getRelationshipDefByName(relationshipType);
typesDef.getRelationshipDefs().add(relationshipDef);
}
for (String bm : context.businessMetadataTypes) {
AtlasBusinessMetadataDef bmDef = typeRegistry.getBusinessMetadataDefByName(bm);
typesDef.getBusinessMetadataDefs().add(bmDef);
}
}
use of org.apache.atlas.model.typedef.AtlasBusinessMetadataDef in project atlas by apache.
the class TestUtilsV2 method defineBusinessMetadataTypes.
public static AtlasTypesDef defineBusinessMetadataTypes() {
String _description = "_description";
Map<String, String> options = new HashMap<>();
options.put("maxStrLength", "20");
AtlasBusinessMetadataDef bmNoApplicableTypes = createBusinessMetadataDef("bmNoApplicableTypes", _description, "1.0", createOptionalAttrDef("attr0", "string", options, _description));
AtlasBusinessMetadataDef bmNoAttributes = createBusinessMetadataDef("bmNoAttributes", _description, "1.0", null);
options.put("applicableEntityTypes", "[\"" + DATABASE_TYPE + "\",\"" + TABLE_TYPE + "\"]");
AtlasBusinessMetadataDef bmWithAllTypes = createBusinessMetadataDef("bmWithAllTypes", _description, "1.0", createOptionalAttrDef("attr1", AtlasBusinessMetadataDef.ATLAS_TYPE_BOOLEAN, options, _description), createOptionalAttrDef("attr2", AtlasBusinessMetadataDef.ATLAS_TYPE_BYTE, options, _description), createOptionalAttrDef("attr3", AtlasBusinessMetadataDef.ATLAS_TYPE_SHORT, options, _description), createOptionalAttrDef("attr4", AtlasBusinessMetadataDef.ATLAS_TYPE_INT, options, _description), createOptionalAttrDef("attr5", AtlasBusinessMetadataDef.ATLAS_TYPE_LONG, options, _description), createOptionalAttrDef("attr6", AtlasBusinessMetadataDef.ATLAS_TYPE_FLOAT, options, _description), createOptionalAttrDef("attr7", AtlasBusinessMetadataDef.ATLAS_TYPE_DOUBLE, options, _description), createOptionalAttrDef("attr8", AtlasBusinessMetadataDef.ATLAS_TYPE_STRING, options, _description), createOptionalAttrDef("attr9", AtlasBusinessMetadataDef.ATLAS_TYPE_DATE, options, _description), createOptionalAttrDef("attr10", "ENUM_1", options, _description));
AtlasBusinessMetadataDef bmWithAllTypesMV = createBusinessMetadataDef("bmWithAllTypesMV", _description, "1.0", createOptionalAttrDef("attr11", "array<boolean>", options, _description), createOptionalAttrDef("attr12", "array<byte>", options, _description), createOptionalAttrDef("attr13", "array<short>", options, _description), createOptionalAttrDef("attr14", "array<int>", options, _description), createOptionalAttrDef("attr15", "array<long>", options, _description), createOptionalAttrDef("attr16", "array<float>", options, _description), createOptionalAttrDef("attr17", "array<double>", options, _description), createOptionalAttrDef("attr18", "array<string>", options, _description), createOptionalAttrDef("attr19", "array<date>", options, _description), createOptionalAttrDef("attr20", "array<ENUM_1>", options, _description));
options.put("applicableEntityTypes", "[\"" + SUPER_TYPE_NAME + "\"]");
AtlasBusinessMetadataDef bmWithSuperType = createBusinessMetadataDef("bmWithSuperType", _description, "1.0", createOptionalAttrDef("attrSuperBoolean", AtlasBusinessMetadataDef.ATLAS_TYPE_BOOLEAN, options, _description), createOptionalAttrDef("attrSuperString", AtlasBusinessMetadataDef.ATLAS_TYPE_STRING, options, _description));
AtlasTypesDef ret = AtlasTypeUtil.getTypesDef(new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), Arrays.asList(bmNoApplicableTypes, bmNoAttributes, bmWithAllTypes, bmWithAllTypesMV, bmWithSuperType));
populateSystemAttributes(ret);
return ret;
}
use of org.apache.atlas.model.typedef.AtlasBusinessMetadataDef in project atlas by apache.
the class AtlasBusinessMetadataDefStoreV2 method getByName.
@Override
public AtlasBusinessMetadataDef getByName(String name) throws AtlasBaseException {
if (LOG.isDebugEnabled()) {
LOG.debug("==> AtlasBusinessMetadataDefStoreV2.getByName({})", name);
}
AtlasVertex vertex = typeDefStore.findTypeVertexByNameAndCategory(name, DataTypes.TypeCategory.BUSINESS_METADATA);
if (vertex == null) {
throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_NOT_FOUND, name);
}
vertex.getProperty(Constants.TYPE_CATEGORY_PROPERTY_KEY, String.class);
AtlasBusinessMetadataDef ret = toBusinessMetadataDef(vertex);
if (LOG.isDebugEnabled()) {
LOG.debug("<== AtlasBusinessMetadataDefStoreV2.getByName({}): {}", name, ret);
}
return ret;
}
Aggregations