Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 33C19200CE6 for ; Fri, 15 Sep 2017 11:56:53 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 327EF1609D1; Fri, 15 Sep 2017 09:56:53 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 27A151609CF for ; Fri, 15 Sep 2017 11:56:52 +0200 (CEST) Received: (qmail 52519 invoked by uid 500); 15 Sep 2017 09:56:51 -0000 Mailing-List: contact commits-help@atlas.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@atlas.apache.org Delivered-To: mailing list commits@atlas.apache.org Received: (qmail 52510 invoked by uid 99); 15 Sep 2017 09:56:51 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Sep 2017 09:56:51 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 15F82F5540; Fri, 15 Sep 2017 09:56:51 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: davidrad@apache.org To: commits@atlas.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: atlas git commit: =ATLAS2058 Add description to attributedefs and relationship enddefs Date: Fri, 15 Sep 2017 09:56:51 +0000 (UTC) archived-at: Fri, 15 Sep 2017 09:56:53 -0000 Repository: atlas Updated Branches: refs/heads/master 586b5eb20 -> 979200e7b =ATLAS2058 Add description to attributedefs and relationship enddefs Project: http://git-wip-us.apache.org/repos/asf/atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/979200e7 Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/979200e7 Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/979200e7 Branch: refs/heads/master Commit: 979200e7b7ed29d66b43d071d8df0c803e0edf27 Parents: 586b5eb Author: David Radley Authored: Tue Sep 12 16:40:22 2017 +0100 Committer: David Radley Committed: Fri Sep 15 10:32:46 2017 +0100 ---------------------------------------------------------------------- .../model/typedef/AtlasRelationshipEndDef.java | 52 ++++++++++++++++++-- .../atlas/model/typedef/AtlasStructDef.java | 20 ++++++-- .../store/graph/v1/AtlasStructDefStoreV1.java | 2 + 3 files changed, 68 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/atlas/blob/979200e7/intg/src/main/java/org/apache/atlas/model/typedef/AtlasRelationshipEndDef.java ---------------------------------------------------------------------- diff --git a/intg/src/main/java/org/apache/atlas/model/typedef/AtlasRelationshipEndDef.java b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasRelationshipEndDef.java index 01e5ce7..c42006b 100644 --- a/intg/src/main/java/org/apache/atlas/model/typedef/AtlasRelationshipEndDef.java +++ b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasRelationshipEndDef.java @@ -60,9 +60,21 @@ public class AtlasRelationshipEndDef implements Serializable { */ private Cardinality cardinality; /** - * When set this indicates that this end is is a legacy attribute + * When set this indicates that this end is a legacy attribute */ private boolean isLegacyAttribute; + /** + * Description of the end + */ + private String description; + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } /** * Base constructor @@ -98,13 +110,44 @@ public class AtlasRelationshipEndDef implements Serializable { public AtlasRelationshipEndDef(String typeName, String name, Cardinality cardinality, boolean isContainer) { this(typeName, name, cardinality, isContainer, false); } - + /** + * + * @param typeName + * - The name of an entityDef type + * @param name + * - The name of the new attribute that the entity instance will pick up. + * @param cardinality + * - whether the end is SINGLE (1) or SET (many) + * @param isContainer + * - whether the end is a container or not + * @param isLegacyAttribute + * - whether this is a legacy attribute + */ public AtlasRelationshipEndDef(String typeName, String name, Cardinality cardinality, boolean isContainer, boolean isLegacyAttribute) { + this(typeName, name, cardinality, isContainer, isLegacyAttribute,""); + } + /** + * + * @param typeName + * - The name of an entityDef type + * @param name + * - The name of the new attribute that the entity instance will pick up. + * @param cardinality + * - whether the end is SINGLE (1) or SET (many) + * @param isContainer + * - whether the end is a container or not + * @param isLegacyAttribute + * - whether this is a legacy attribute + * @param description + * - The description of this end of the relationship. + */ + public AtlasRelationshipEndDef(String typeName, String name, Cardinality cardinality, boolean isContainer, boolean isLegacyAttribute, String description) { setType(typeName); setName(name); setCardinality(cardinality); setIsContainer(isContainer); setIsLegacyAttribute(isLegacyAttribute); + setDescription(description); } /** @@ -118,6 +161,7 @@ public class AtlasRelationshipEndDef implements Serializable { setIsContainer(other.getIsContainer()); setCardinality(other.getCardinality()); setIsLegacyAttribute(other.isLegacyAttribute); + setDescription(other.description); } } @@ -177,6 +221,7 @@ public class AtlasRelationshipEndDef implements Serializable { sb.append("AtlasRelationshipEndDef{"); sb.append("type='").append(type).append('\''); sb.append(", name==>'").append(name).append('\''); + sb.append(", description==>'").append(description).append('\''); sb.append(", isContainer==>'").append(isContainer).append('\''); sb.append(", cardinality==>'").append(cardinality).append('\''); sb.append(", isLegacyAttribute==>'").append(isLegacyAttribute).append('\''); @@ -195,6 +240,7 @@ public class AtlasRelationshipEndDef implements Serializable { return Objects.equals(type, that.type) && Objects.equals(name, that.name) && + Objects.equals(description, that.description) && isContainer == that.isContainer && cardinality == that.cardinality && isLegacyAttribute == that.isLegacyAttribute; @@ -202,7 +248,7 @@ public class AtlasRelationshipEndDef implements Serializable { @Override public int hashCode() { - return Objects.hash(type, getName(), isContainer, cardinality, isLegacyAttribute); + return Objects.hash(type, getName(), description, isContainer, cardinality, isLegacyAttribute); } @Override http://git-wip-us.apache.org/repos/asf/atlas/blob/979200e7/intg/src/main/java/org/apache/atlas/model/typedef/AtlasStructDef.java ---------------------------------------------------------------------- diff --git a/intg/src/main/java/org/apache/atlas/model/typedef/AtlasStructDef.java b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasStructDef.java index 3a5c43a..e20a426 100644 --- a/intg/src/main/java/org/apache/atlas/model/typedef/AtlasStructDef.java +++ b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasStructDef.java @@ -272,6 +272,7 @@ public class AtlasStructDef extends AtlasBaseTypeDef implements Serializable { private boolean isUnique; private boolean isIndexable; private String defaultValue; + private String description; private List constraints; @@ -281,14 +282,15 @@ public class AtlasStructDef extends AtlasBaseTypeDef implements Serializable { this(name, typeName, false, Cardinality.SINGLE, COUNT_NOT_SET, COUNT_NOT_SET, false, false, null); } + public AtlasAttributeDef(String name, String typeName, boolean isOptional, Cardinality cardinality, int valuesMinCount, int valuesMaxCount, boolean isUnique, boolean isIndexable, List constraints) { - this(name, typeName, isOptional, cardinality, valuesMinCount, valuesMaxCount, isUnique, isIndexable, null, constraints); + this(name, typeName, isOptional, cardinality, valuesMinCount, valuesMaxCount, isUnique, isIndexable, null, constraints, ""); } public AtlasAttributeDef(String name, String typeName, boolean isOptional, Cardinality cardinality, int valuesMinCount, int valuesMaxCount, boolean isUnique, boolean isIndexable, String defaultValue, - List constraints) { + List constraints, String description) { setName(name); setTypeName(typeName); setIsOptional(isOptional); @@ -299,6 +301,7 @@ public class AtlasStructDef extends AtlasBaseTypeDef implements Serializable { setIsIndexable(isIndexable); setDefaultValue(defaultValue); setConstraints(constraints); + setDescription(description); } public AtlasAttributeDef(AtlasAttributeDef other) { @@ -313,6 +316,7 @@ public class AtlasStructDef extends AtlasBaseTypeDef implements Serializable { setIsIndexable(other.getIsIndexable()); setDefaultValue(other.getDefaultValue()); setConstraints(other.getConstraints()); + setDescription((other.getDescription())); } } @@ -412,6 +416,14 @@ public class AtlasStructDef extends AtlasBaseTypeDef implements Serializable { cDefs.add(constraintDef); } + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + public StringBuilder toString(StringBuilder sb) { if (sb == null) { sb = new StringBuilder(); @@ -420,6 +432,7 @@ public class AtlasStructDef extends AtlasBaseTypeDef implements Serializable { sb.append("AtlasAttributeDef{"); sb.append("name='").append(name).append('\''); sb.append(", typeName='").append(typeName).append('\''); + sb.append(", description='").append(description).append('\''); sb.append(", getIsOptional=").append(isOptional); sb.append(", cardinality=").append(cardinality); sb.append(", valuesMinCount=").append(valuesMinCount); @@ -458,12 +471,13 @@ public class AtlasStructDef extends AtlasBaseTypeDef implements Serializable { Objects.equals(typeName, that.typeName) && cardinality == that.cardinality && Objects.equals(defaultValue, that.defaultValue) && + Objects.equals(description, that.description) && Objects.equals(constraints, that.constraints); } @Override public int hashCode() { - return Objects.hash(name, typeName, isOptional, cardinality, valuesMinCount, valuesMaxCount, isUnique, isIndexable, defaultValue, constraints); + return Objects.hash(name, typeName, isOptional, cardinality, valuesMinCount, valuesMaxCount, isUnique, isIndexable, defaultValue, constraints, description); } @Override http://git-wip-us.apache.org/repos/asf/atlas/blob/979200e7/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java index c3c42be..86f1b88 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java @@ -463,6 +463,7 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1