private void rectifyOwnedReferenceError(AtlasStructDef structDef, AtlasAttributeDef attributeDef) { List<AtlasConstraintDef> constraints = attributeDef.getConstraints(); if (CollectionUtils.isNotEmpty(constraints)) { for (int i = 0; i < constraints.size(); i++) { AtlasConstraintDef constraint = constraints.get(i); if (constraint.isConstraintType(AtlasConstraintDef.CONSTRAINT_TYPE_OWNED_REF)) { LOG.warn("Invalid constraint ownedRef for attribute {}.{}", structDef.getName(), attributeDef.getName()); constraints.remove(i); i--; } } } }
private boolean hasOwnedReferenceConstraint(List<AtlasConstraintDef> constraints) { if (CollectionUtils.isNotEmpty(constraints)) { for (AtlasConstraintDef constraint : constraints) { if (constraint.isConstraintType(AtlasConstraintDef.CONSTRAINT_TYPE_OWNED_REF)) { return true; } } } return false; }
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; }
if (constraint.isConstraintType(CONSTRAINT_TYPE_OWNED_REF)) { AtlasEntityType attrType = getReferencedEntityType(typeRegistry.getType(attributeDef.getTypeName())); getTypeName(), attributeDef.getName(), CONSTRAINT_TYPE_OWNED_REF, attributeDef.getTypeName()); } else if (constraint.isConstraintType(CONSTRAINT_TYPE_INVERSE_REF)) { AtlasEntityType attrType = getReferencedEntityType(typeRegistry.getType(attributeDef.getTypeName()));
if (constraint.isConstraintType(CONSTRAINT_TYPE_OWNED_REF)) { AtlasEntityType attrType = getReferencedEntityType(typeRegistry.getType(attributeDef.getTypeName())); getTypeName(), attributeDef.getName(), CONSTRAINT_TYPE_OWNED_REF, attributeDef.getTypeName()); } else if (constraint.isConstraintType(CONSTRAINT_TYPE_INVERSE_REF)) { AtlasEntityType attrType = getReferencedEntityType(typeRegistry.getType(attributeDef.getTypeName()));
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; }