atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From david...@apache.org
Subject atlas git commit: =ATLAS2058 Add description to attributedefs and relationship enddefs
Date Fri, 15 Sep 2017 09:56:51 GMT
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 <david_radley@uk.ibm.com>
Authored: Tue Sep 12 16:40:22 2017 +0100
Committer: David Radley <david_radley@uk.ibm.com>
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<AtlasConstraintDef> 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<AtlasConstraintDef> 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<AtlasConstraintDef> constraints) {
+                                 List<AtlasConstraintDef> 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<AtlasStructDe
         attribInfo.put("isComposite", attribute.isOwnedRef());
         attribInfo.put("reverseAttributeName", attribute.getInverseRefAttributeName());
         attribInfo.put("defaultValue", attributeDef.getDefaultValue());
+        attribInfo.put("description", attributeDef.getDescription());
 
         final int lower;
         final int upper;
@@ -502,6 +503,7 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasStructDe
         ret.setIsUnique((Boolean) attribInfo.get("isUnique"));
         ret.setIsIndexable((Boolean) attribInfo.get("isIndexable"));
         ret.setDefaultValue((String) attribInfo.get("defaultValue"));
+        ret.setDescription((String) attribInfo.get("description"));
 
         if ((Boolean)attribInfo.get("isComposite")) {
             ret.addConstraint(new AtlasConstraintDef(AtlasConstraintDef.CONSTRAINT_TYPE_OWNED_REF));


Mime
View raw message