public static AtlasAttributeDef createRequiredAttrDef(String name, String dataType) { return new AtlasAttributeDef(name, dataType, false, Cardinality.SINGLE, 1, 1, false, true, false, Collections.<AtlasConstraintDef>emptyList()); }
public static AtlasAttributeDef createListRequiredAttrDef(String name, String dataType) { return new AtlasAttributeDef(name, dataType, false, Cardinality.LIST, 1, Integer.MAX_VALUE, false, true, false, Collections.<AtlasConstraintDef>emptyList()); }
public static AtlasAttributeDef createUniqueRequiredAttrDef(String name, String typeName) { return new AtlasAttributeDef(name, typeName, false, Cardinality.SINGLE, 1, 1, true, true, Collections.<AtlasConstraintDef>emptyList()); }
public static AtlasAttributeDef createRequiredAttrDef(String name, AtlasType dataType) { return new AtlasAttributeDef(name, dataType.getTypeName(), false, Cardinality.SINGLE, 1, 1, false, true, false, Collections.<AtlasConstraintDef>emptyList()); }
public static AtlasAttributeDef createOptionalAttrDef(String name, AtlasType dataType) { return new AtlasAttributeDef(name, dataType.getTypeName(), true, Cardinality.SINGLE, 0, 1, false, false, false, Collections.<AtlasConstraintDef>emptyList()); }
public static AtlasEntityDef getSingleEntityWithName(String name) { AtlasEntityDef developerTypeDef = createClassTypeDef(name, "Developer_description", Collections.<String>emptySet(), new AtlasAttributeDef("language", String.format("array<%s>", "string"), false, AtlasAttributeDef.Cardinality.SET, 1, 10, false, false, false, Collections.<AtlasConstraintDef>emptyList())); return developerTypeDef; }
public static List<AtlasEntityDef> getEntityWithValidSuperType() { AtlasEntityDef developerTypeDef = createClassTypeDef("Developer", "Developer_description", Collections.singleton("Employee"), new AtlasAttributeDef("language", String.format("array<%s>", "string"), false, AtlasAttributeDef.Cardinality.SET, 1, 10, false, false, false, Collections.<AtlasConstraintDef>emptyList())); List<AtlasEntityDef> ret = Arrays.asList(developerTypeDef); populateSystemAttributes(ret); return ret; }
private List<AtlasStructDef.AtlasAttributeDef> getAtlasAttributeDefs(String... names) { List<AtlasStructDef.AtlasAttributeDef> list = new ArrayList<>(); for (String s : names) { list.add(new AtlasStructDef.AtlasAttributeDef(s, AtlasBaseTypeDef.ATLAS_TYPE_STRING)); } return list; }
public static AtlasAttributeDef createUniqueRequiredAttrDef(String name, AtlasType dataType) { return new AtlasAttributeDef(name, dataType.getTypeName(), false, Cardinality.SINGLE, 1, 1, true, true, Collections.<AtlasConstraintDef>emptyList()); }
public static AtlasAttributeDef createListRequiredAttrDef(String name, String dataType) { return new AtlasAttributeDef(name, dataType, false, Cardinality.LIST, 1, Integer.MAX_VALUE, false, true, Collections.<AtlasConstraintDef>emptyList()); }
public static AtlasAttributeDef createRequiredAttrDef(String name, AtlasType dataType) { return new AtlasAttributeDef(name, dataType.getTypeName(), false, Cardinality.SINGLE, 1, 1, false, true, Collections.<AtlasConstraintDef>emptyList()); }
protected AtlasClassificationDef getTagWithName(AtlasTypesDef typesDef, String tagName, String attributeType) { AtlasClassificationDef aTag = new AtlasClassificationDef(tagName); AtlasAttributeDef attributeDef = new AtlasAttributeDef("testAttribute", attributeType, true, AtlasAttributeDef.Cardinality.SINGLE, 0, 1, false, true, false, Collections.emptyList()); aTag.addAttribute(attributeDef); typesDef.setClassificationDefs(Arrays.asList(aTag)); return aTag; }
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; }
private AtlasEntityDef createColumnEntityDefWithMissingInverseAttribute() { AtlasEntityDef column = new AtlasEntityDef(TYPE_COLUMN); AtlasAttributeDef attrTable = new AtlasAttributeDef(ATTR_TABLE, TYPE_TABLE); attrTable.addConstraint(new AtlasConstraintDef(AtlasConstraintDef.CONSTRAINT_TYPE_INVERSE_REF)); column.addAttribute(attrTable); return column; }
private AtlasEntityDef createTableEntityDef() { AtlasEntityDef table = new AtlasEntityDef(TYPE_TABLE); AtlasAttributeDef attrName = new AtlasAttributeDef(ATTR_NAME, AtlasBaseTypeDef.ATLAS_TYPE_STRING); AtlasAttributeDef attrColumns = new AtlasAttributeDef(ATTR_COLUMNS, AtlasBaseTypeDef.getArrayTypeName(TYPE_COLUMN)); attrColumns.addConstraint(new AtlasConstraintDef(AtlasConstraintDef.CONSTRAINT_TYPE_OWNED_REF)); table.addAttribute(attrName); table.addAttribute(attrColumns); return table; }
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; }
@Test public void testStructDefAddAttribute() { AtlasStructDef structDef = ModelTestUtil.newStructDef(); structDef.addAttribute(new AtlasAttributeDef("newAttribute", AtlasBaseTypeDef.ATLAS_TYPE_INT)); assertTrue(structDef.hasAttribute("newAttribute")); }
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; }
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; }
public static AtlasAttributeDef createUniqueRequiredAttrDef(String name, AtlasType dataType) { return new AtlasAttributeDef(name, dataType.getTypeName(), false, Cardinality.SINGLE, 1, 1, true, true, false, Collections.<AtlasConstraintDef>emptyList()); }