public AtlasStructDef getDefinedInDef() { return definedInType.getStructDef(); }
public AtlasStructDef getDefinedInDef() { return definedInType.getStructDef(); }
private static TypesDef structToTypesDef(AtlasStructType structType, AtlasTypeRegistry registry) { String typeName = structType.getStructDef().getName(); String typeDesc = structType.getStructDef().getDescription(); String typeVersion = structType.getStructDef().getTypeVersion(); List<AttributeDefinition> attributes = getAttributes(structType, registry); StructTypeDefinition structTypeDef = new StructTypeDefinition(typeName, typeDesc, typeVersion, attributes); TypesDef ret = new TypesDef(null, Arrays.asList(structTypeDef), null, null); return ret; }
private void addAttributeTypes(AtlasStructType structType, ExportContext context) { for (AtlasAttributeDef attributeDef : structType.getStructDef().getAttributeDefs()) { addType(attributeDef.getTypeName(), context); } }
private void addAttributeTypes(AtlasStructType structType, ExportService.ExportContext context) { for (AtlasStructDef.AtlasAttributeDef attributeDef : structType.getStructDef().getAttributeDefs()) { addType(attributeDef.getTypeName(), context); } }
private void addAttributeTypes(AtlasStructType structType, ExportContext context) { for (AtlasAttributeDef attributeDef : structType.getStructDef().getAttributeDefs()) { addType(attributeDef.getTypeName(), context); } }
private AtlasBaseTypeDef getTypeDefFromType(AtlasType type) throws AtlasBaseException { AtlasBaseTypeDef ret; switch (type.getTypeCategory()) { case ENUM: ret = ((AtlasEnumType) type).getEnumDef(); break; case STRUCT: ret = ((AtlasStructType) type).getStructDef(); break; case CLASSIFICATION: ret = ((AtlasClassificationType) type).getClassificationDef(); break; case ENTITY: ret = ((AtlasEntityType) type).getEntityDef(); break; case PRIMITIVE: case OBJECT_ID_TYPE: case ARRAY: case MAP: default: throw new AtlasBaseException(AtlasErrorCode.SYSTEM_TYPE, type.getTypeCategory().name()); } return ret; }
private static List<AttributeDefinition> getAttributes(AtlasStructType structType, AtlasTypeRegistry registry) { List<AttributeDefinition> ret = new ArrayList<>(); List<AtlasAttributeDef> attrDefs = structType.getStructDef().getAttributeDefs(); if (CollectionUtils.isNotEmpty(attrDefs)) { for (AtlasAttributeDef attrDef : attrDefs) { AtlasAttribute attribute = structType.getAttribute(attrDef.getName()); AttributeDefinition oldAttrDef = AtlasStructDefStoreV2.toAttributeDefinition(attribute); ret.add(new AttributeDefinition(oldAttrDef.getName(), oldAttrDef.getDataTypeName(), new Multiplicity(oldAttrDef.getMultiplicity()), oldAttrDef.getIsComposite(), oldAttrDef.getIsUnique(), oldAttrDef.getIsIndexable(), oldAttrDef.getReverseAttributeName())); } } return ret; } }
public AtlasAttribute(AtlasStructType definedInType, AtlasAttributeDef attrDef, AtlasType attributeType, String relationshipLabel) { this.definedInType = definedInType; this.attributeDef = attrDef; this.attributeType = attributeType.getTypeForAttribute(); this.qualifiedName = getQualifiedAttributeName(definedInType.getStructDef(), attributeDef.getName()); this.vertexPropertyName = encodePropertyKey(this.qualifiedName); this.relationshipEdgeLabel = getRelationshipEdgeLabel(relationshipLabel); boolean isOwnedRef = false; String inverseRefAttribute = null; if (CollectionUtils.isNotEmpty(attributeDef.getConstraints())) { for (AtlasConstraintDef constraint : attributeDef.getConstraints()) { if (constraint.isConstraintType(CONSTRAINT_TYPE_OWNED_REF)) { isOwnedRef = true; } if (constraint.isConstraintType(CONSTRAINT_TYPE_INVERSE_REF)) { Object val = constraint.getParam(CONSTRAINT_PARAM_ATTRIBUTE); if (val != null) { inverseRefAttribute = val.toString(); } } } } this.isOwnedRef = isOwnedRef; this.inverseRefAttributeName = inverseRefAttribute; this.relationshipEdgeDirection = AtlasRelationshipEdgeDirection.OUT; }
public AtlasAttribute(AtlasStructType definedInType, AtlasAttributeDef attrDef, AtlasType attributeType, String relationshipLabel) { this.definedInType = definedInType; this.attributeDef = attrDef; this.attributeType = attributeType.getTypeForAttribute(); this.qualifiedName = getQualifiedAttributeName(definedInType.getStructDef(), attributeDef.getName()); this.vertexPropertyName = encodePropertyKey(this.qualifiedName); this.relationshipEdgeLabel = getRelationshipEdgeLabel(relationshipLabel); boolean isOwnedRef = false; String inverseRefAttribute = null; if (CollectionUtils.isNotEmpty(attributeDef.getConstraints())) { for (AtlasConstraintDef constraint : attributeDef.getConstraints()) { if (constraint.isConstraintType(CONSTRAINT_TYPE_OWNED_REF)) { isOwnedRef = true; } if (constraint.isConstraintType(CONSTRAINT_TYPE_INVERSE_REF)) { Object val = constraint.getParam(CONSTRAINT_PARAM_ATTRIBUTE); if (val != null) { inverseRefAttribute = val.toString(); } } } } this.isOwnedRef = isOwnedRef; this.inverseRefAttributeName = inverseRefAttribute; this.relationshipEdgeDirection = AtlasRelationshipEdgeDirection.OUT; }
typesDef.getStructDefs().add(structType.getStructDef());
private AtlasBaseTypeDef getTypeDefFromType(AtlasType type) throws AtlasBaseException { AtlasBaseTypeDef ret; switch (type.getTypeCategory()) { case ENUM: ret = ((AtlasEnumType) type).getEnumDef(); break; case STRUCT: ret = ((AtlasStructType) type).getStructDef(); break; case CLASSIFICATION: ret = ((AtlasClassificationType) type).getClassificationDef(); break; case ENTITY: ret = ((AtlasEntityType) type).getEntityDef(); break; case RELATIONSHIP: ret = ((AtlasRelationshipType) type).getRelationshipDef(); break; case PRIMITIVE: case OBJECT_ID_TYPE: case ARRAY: case MAP: default: throw new AtlasBaseException(AtlasErrorCode.SYSTEM_TYPE, type.getTypeCategory().name()); } return ret; }
private void resolveConstraints(AtlasTypeRegistry typeRegistry) throws AtlasBaseException { for (AtlasAttributeDef attributeDef : getStructDef().getAttributeDefs()) { if (CollectionUtils.isEmpty(attributeDef.getConstraints())) { continue;
private void resolveConstraints(AtlasTypeRegistry typeRegistry) throws AtlasBaseException { for (AtlasAttributeDef attributeDef : getStructDef().getAttributeDefs()) { if (CollectionUtils.isEmpty(attributeDef.getConstraints())) { continue;