use of org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef 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;
}
use of org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef in project incubator-atlas by apache.
the class AtlasTypeUtil method createRequiredListAttrDefWithConstraint.
public static AtlasAttributeDef createRequiredListAttrDefWithConstraint(String name, String dataType, String type, Map param) {
AtlasAttributeDef ret = AtlasTypeUtil.createListRequiredAttrDef(name, dataType);
ret.addConstraint(new AtlasConstraintDef(type, param));
return ret;
}
use of org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef in project incubator-atlas by apache.
the class AtlasTypeUtil method createOptionalAttrDefWithConstraint.
public static AtlasAttributeDef createOptionalAttrDefWithConstraint(String name, String typeName, String type, Map param) {
AtlasAttributeDef ret = AtlasTypeUtil.createOptionalAttrDef(name, typeName);
ret.addConstraint(new AtlasConstraintDef(type, param));
return ret;
}
use of org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef in project incubator-atlas by apache.
the class TestAtlasEntityType method createColumnEntityDefWithInvaidAttributeTypeForInverseAttribute.
private AtlasEntityDef createColumnEntityDefWithInvaidAttributeTypeForInverseAttribute() {
AtlasEntityDef column = new AtlasEntityDef(TYPE_COLUMN);
AtlasAttributeDef attrTable = new AtlasAttributeDef(ATTR_NAME, AtlasBaseTypeDef.ATLAS_TYPE_STRING);
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.AtlasAttributeDef in project incubator-atlas by apache.
the class TestAtlasStructDef method testStructDefHasAttribute.
@Test
public void testStructDefHasAttribute() {
AtlasStructDef structDef = ModelTestUtil.getStructDef();
for (AtlasAttributeDef attributeDef : structDef.getAttributeDefs()) {
assertTrue(structDef.hasAttribute(attributeDef.getName()));
}
assertFalse(structDef.hasAttribute("01234-xyzabc-;''-)("));
}
Aggregations