use of org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef in project incubator-atlas by apache.
the class TestAtlasEntityType method createColumnEntityDefWithInvalidInverseAttributeType.
private AtlasEntityDef createColumnEntityDefWithInvalidInverseAttributeType() {
AtlasEntityDef column = new AtlasEntityDef(TYPE_COLUMN);
AtlasAttributeDef attrTable = new AtlasAttributeDef(ATTR_TABLE, TYPE_TABLE);
Map<String, Object> params = new HashMap<>();
params.put(AtlasConstraintDef.CONSTRAINT_PARAM_ATTRIBUTE, ATTR_NAME);
attrTable.addConstraint(new AtlasConstraintDef(AtlasConstraintDef.CONSTRAINT_TYPE_INVERSE_REF, params));
column.addAttribute(attrTable);
return column;
}
use of org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef in project incubator-atlas by apache.
the class TestAtlasEntityType method createColumnEntityDef.
private AtlasEntityDef createColumnEntityDef() {
AtlasEntityDef column = new AtlasEntityDef(TYPE_COLUMN);
AtlasAttributeDef attrTable = new AtlasAttributeDef(ATTR_TABLE, TYPE_TABLE);
Map<String, Object> params = new HashMap<>();
params.put(AtlasConstraintDef.CONSTRAINT_PARAM_ATTRIBUTE, ATTR_COLUMNS);
attrTable.addConstraint(new AtlasConstraintDef(AtlasConstraintDef.CONSTRAINT_TYPE_INVERSE_REF, params));
column.addAttribute(attrTable);
return column;
}
use of org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef in project incubator-atlas by apache.
the class TestAtlasEntityType method createColumnEntityDefWithNonExistingInverseAttribute.
private AtlasEntityDef createColumnEntityDefWithNonExistingInverseAttribute() {
AtlasEntityDef column = new AtlasEntityDef(TYPE_COLUMN);
AtlasAttributeDef attrTable = new AtlasAttributeDef(ATTR_TABLE, TYPE_TABLE);
Map<String, Object> params = new HashMap<>();
params.put(AtlasConstraintDef.CONSTRAINT_PARAM_ATTRIBUTE, "non-existing:" + ATTR_COLUMNS);
attrTable.addConstraint(new AtlasConstraintDef(AtlasConstraintDef.CONSTRAINT_TYPE_INVERSE_REF, params));
column.addAttribute(attrTable);
return column;
}
use of org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef in project incubator-atlas by apache.
the class TypedefsJerseyResourceIT method createHiveTypesV2.
private AtlasTypesDef createHiveTypesV2() throws Exception {
AtlasTypesDef atlasTypesDef = new AtlasTypesDef();
AtlasEntityDef databaseTypeDefinition = createClassTypeDef("database", ImmutableSet.<String>of(), AtlasTypeUtil.createUniqueRequiredAttrDef("name", "string"), AtlasTypeUtil.createRequiredAttrDef("description", "string"));
atlasTypesDef.getEntityDefs().add(databaseTypeDefinition);
AtlasEntityDef tableTypeDefinition = createClassTypeDef("table", ImmutableSet.<String>of(), AtlasTypeUtil.createUniqueRequiredAttrDef("name", "string"), AtlasTypeUtil.createRequiredAttrDef("description", "string"), AtlasTypeUtil.createOptionalAttrDef("columnNames", DataTypes.arrayTypeName("string")), AtlasTypeUtil.createOptionalAttrDef("created", "date"), AtlasTypeUtil.createOptionalAttrDef("parameters", DataTypes.mapTypeName("string", "string")), AtlasTypeUtil.createRequiredAttrDef("type", "string"), new AtlasAttributeDef("database", "database", false, Cardinality.SINGLE, 1, 1, true, true, Collections.<AtlasConstraintDef>emptyList()));
atlasTypesDef.getEntityDefs().add(tableTypeDefinition);
AtlasClassificationDef fetlTypeDefinition = AtlasTypeUtil.createTraitTypeDef("fetl", ImmutableSet.<String>of(), AtlasTypeUtil.createRequiredAttrDef("level", "int"));
atlasTypesDef.getClassificationDefs().add(fetlTypeDefinition);
return atlasTypesDef;
}
use of org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef in project incubator-atlas by apache.
the class AtlasTypeUtil method createRequiredAttrDefWithConstraint.
public static AtlasAttributeDef createRequiredAttrDefWithConstraint(String name, String typeName, String type, Map param) {
AtlasAttributeDef ret = AtlasTypeUtil.createRequiredAttrDef(name, typeName);
ret.addConstraint(new AtlasConstraintDef(type, param));
return ret;
}
Aggregations