atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ames...@apache.org
Subject [38/50] [abbrv] atlas git commit: ATLAS-2923: Options copied to AttributeDefinition
Date Thu, 01 Nov 2018 23:02:24 GMT
ATLAS-2923: Options copied to AttributeDefinition


Project: http://git-wip-us.apache.org/repos/asf/atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/7952682a
Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/7952682a
Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/7952682a

Branch: refs/heads/branch-1.0
Commit: 7952682a346f26972c362a64b6fa9b2c06a4cafa
Parents: bb733db
Author: Ashutosh Mestry <amestry@hortonworks.com>
Authored: Mon Oct 15 15:53:07 2018 -0700
Committer: Ashutosh Mestry <amestry@hortonworks.com>
Committed: Thu Nov 1 15:42:58 2018 -0700

----------------------------------------------------------------------
 addons/models/0010-base_model.json              | 335 -------------------
 .../org/apache/atlas/type/AtlasTypeUtil.java    |   1 +
 .../v1/model/typedef/AttributeDefinition.java   |  31 +-
 .../v1/typesystem/types/utils/TypesUtil.java    |   6 +-
 .../converters/TypeConverterUtil.java           |   2 +-
 5 files changed, 29 insertions(+), 346 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/7952682a/addons/models/0010-base_model.json
----------------------------------------------------------------------
diff --git a/addons/models/0010-base_model.json b/addons/models/0010-base_model.json
deleted file mode 100644
index 1bfbf2f..0000000
--- a/addons/models/0010-base_model.json
+++ /dev/null
@@ -1,335 +0,0 @@
-{
-  "enumDefs": [],
-  "structDefs": [],
-  "classificationDefs": [
-    {
-      "name": "TaxonomyTerm",
-      "superTypes": [],
-      "typeVersion": "1.0",
-      "attributeDefs": [
-        {
-          "name": "atlas.taxonomy",
-          "typeName": "string",
-          "cardinality": "SINGLE",
-          "isIndexable": false,
-          "isOptional": true,
-          "isUnique": false
-        }
-      ]
-    }
-  ],
-  "entityDefs": [
-    {
-      "name": "Referenceable",
-      "superTypes": [],
-      "typeVersion": "1.0",
-      "attributeDefs": [
-        {
-          "name": "qualifiedName",
-          "typeName": "string",
-          "cardinality": "SINGLE",
-          "isIndexable": true,
-          "isOptional": false,
-          "isUnique": true
-        }
-      ]
-    },
-    {
-      "name": "__internal",
-      "superTypes": [],
-      "typeVersion": "1.0",
-      "attributeDefs": []
-    },
-    {
-      "name": "Asset",
-      "superTypes": [],
-      "typeVersion": "1.0",
-      "attributeDefs": [
-        {
-          "name": "name",
-          "typeName": "string",
-          "cardinality": "SINGLE",
-          "isIndexable": true,
-          "isOptional": false,
-          "isUnique": false
-        },
-        {
-          "name": "description",
-          "typeName": "string",
-          "cardinality": "SINGLE",
-          "isIndexable": false,
-          "isOptional": true,
-          "isUnique": false
-        },
-        {
-          "name": "owner",
-          "typeName": "string",
-          "cardinality": "SINGLE",
-          "isIndexable": true,
-          "isOptional": true,
-          "isUnique": false
-        }
-      ]
-    },
-    {
-      "name": "DataSet",
-      "superTypes": [
-        "Referenceable",
-        "Asset"
-      ],
-      "typeVersion": "1.0",
-      "attributeDefs": []
-    },
-    {
-      "name": "Infrastructure",
-      "superTypes": [
-        "Referenceable",
-        "Asset"
-      ],
-      "typeVersion": "1.0",
-      "attributeDefs": []
-    },
-    {
-      "name": "Process",
-      "superTypes": [
-        "Referenceable",
-        "Asset"
-      ],
-      "typeVersion": "1.0",
-      "attributeDefs": [
-        {
-          "name": "inputs",
-          "typeName": "array<DataSet>",
-          "cardinality": "SINGLE",
-          "isIndexable": false,
-          "isOptional": true,
-          "isUnique": false
-        },
-        {
-          "name": "outputs",
-          "typeName": "array<DataSet>",
-          "cardinality": "SINGLE",
-          "isIndexable": false,
-          "isOptional": true,
-          "isUnique": false
-        }
-      ]
-    },
-    {
-      "name": "AtlasServer",
-      "typeVersion": "1.0",
-      "superTypes": [
-      ],
-      "attributeDefs": [
-        {
-          "name": "name",
-          "typeName": "string",
-          "cardinality": "SINGLE",
-          "isIndexable": true,
-          "isOptional": false,
-          "isUnique": false
-        },
-        {
-          "name": "displayName",
-          "typeName": "string",
-          "cardinality": "SINGLE",
-          "isIndexable": true,
-          "isOptional": false,
-          "isUnique": false
-        },
-        {
-          "name": "fullName",
-          "typeName": "string",
-          "cardinality": "SINGLE",
-          "isIndexable": true,
-          "isOptional": false,
-          "isUnique": true
-        },
-        {
-          "name": "urls",
-          "typeName": "array<string>",
-          "cardinality": "SINGLE",
-          "isIndexable": false,
-          "isOptional": true,
-          "isUnique": false
-        },
-        {
-          "name": "additionalInfo",
-          "typeName": "map<string,string>",
-          "cardinality": "SINGLE",
-          "isIndexable": false,
-          "isOptional": true,
-          "isUnique": false
-        }
-      ]
-    },
-    {
-      "name": "__AtlasUserProfile",
-      "superTypes": [
-        "__internal"
-      ],
-      "typeVersion": "1.0",
-      "attributeDefs": [
-        {
-          "name": "name",
-          "typeName": "string",
-          "cardinality": "SINGLE",
-          "isIndexable": true,
-          "isOptional": false,
-          "isUnique": true
-        },
-        {
-          "name": "fullName",
-          "typeName": "string",
-          "cardinality": "SINGLE",
-          "isIndexable": false,
-          "isOptional": true,
-          "isUnique": false
-        },
-        {
-          "name": "savedSearches",
-          "typeName": "array<__AtlasUserSavedSearch>",
-          "cardinality": "LIST",
-          "isIndexable": false,
-          "isOptional": true,
-          "isUnique": false,
-          "constraints": [
-            {
-              "type": "ownedRef"
-            }
-          ]
-        }
-      ]
-    },
-    {
-      "name": "__AtlasUserSavedSearch",
-      "superTypes": [
-        "__internal"
-      ],
-      "typeVersion": "1.0",
-      "attributeDefs": [
-        {
-          "name": "name",
-          "typeName": "string",
-          "cardinality": "SINGLE",
-          "isIndexable": false,
-          "isOptional": false,
-          "isUnique": false
-        },
-        {
-          "name": "ownerName",
-          "typeName": "string",
-          "cardinality": "SINGLE",
-          "isIndexable": false,
-          "isOptional": false,
-          "isUnique": false
-        },
-        {
-          "name": "uniqueName",
-          "typeName": "string",
-          "cardinality": "SINGLE",
-          "isIndexable": true,
-          "isOptional": false,
-          "isUnique": true
-        },
-        {
-          "name": "searchType",
-          "typeName": "string",
-          "cardinality": "SINGLE",
-          "isIndexable": true,
-          "isOptional": false,
-          "isUnique": false
-        },
-        {
-          "name": "searchParameters",
-          "typeName": "string",
-          "cardinality": "SINGLE",
-          "isIndexable": false,
-          "isOptional": false,
-          "isUnique": false
-        },
-        {
-          "name": "searchParameters",
-          "typeName": "string",
-          "cardinality": "SINGLE",
-          "isIndexable": false,
-          "isOptional": true,
-          "isUnique": false
-        }
-      ]
-    },
-    {
-      "name": "__ExportImportAuditEntry",
-      "typeVersion": "1.0",
-      "superTypes": [
-        "__internal"
-      ],
-      "attributeDefs": [
-        {
-          "name": "userName",
-          "typeName": "string",
-          "cardinality": "SINGLE",
-          "isIndexable": false,
-          "isOptional": true,
-          "isUnique": false
-        },
-        {
-          "name": "operation",
-          "typeName": "string",
-          "cardinality": "SINGLE",
-          "isIndexable": true,
-          "isOptional": false,
-          "isUnique": false
-        },
-        {
-          "name": "sourceServerName",
-          "typeName": "string",
-          "cardinality": "SINGLE",
-          "isIndexable": true,
-          "isOptional": true,
-          "isUnique": false
-        },
-        {
-          "name": "targetServerName",
-          "typeName": "string",
-          "cardinality": "SINGLE",
-          "isIndexable": true,
-          "isOptional": true,
-          "isUnique": false
-        },
-        {
-          "name": "operationParams",
-          "typeName": "string",
-          "cardinality": "SINGLE",
-          "isIndexable": true,
-          "isOptional": true,
-          "isUnique": false
-        },
-        {
-          "name": "operationStartTime",
-          "typeName": "long",
-          "cardinality": "SINGLE",
-          "isIndexable": true,
-          "isOptional": false,
-          "isUnique": false
-        },
-        {
-          "name": "operationEndTime",
-          "typeName": "long",
-          "cardinality": "SINGLE",
-          "isIndexable": true,
-          "isOptional": true,
-          "isUnique": false
-        },
-        {
-          "name": "resultSummary",
-          "typeName": "string",
-          "cardinality": "SINGLE",
-          "isIndexable": false,
-          "isOptional": true,
-          "isUnique": false
-        }
-      ]
-    }
-  ]
-}

http://git-wip-us.apache.org/repos/asf/atlas/blob/7952682a/intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java b/intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java
index e6c17af..78df622 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java
@@ -481,6 +481,7 @@ public class AtlasTypeUtil {
         ret.setReverseAttributeName(attribute.getInverseRefAttributeName());
         ret.setDefaultValue(attributeDef.getDefaultValue());
         ret.setDescription(attributeDef.getDescription());
+        ret.setOptions(attributeDef.getOptions());
 
         final int lower;
         final int upper;

http://git-wip-us.apache.org/repos/asf/atlas/blob/7952682a/intg/src/main/java/org/apache/atlas/v1/model/typedef/AttributeDefinition.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/v1/model/typedef/AttributeDefinition.java
b/intg/src/main/java/org/apache/atlas/v1/model/typedef/AttributeDefinition.java
index b54c22b..e353856 100644
--- a/intg/src/main/java/org/apache/atlas/v1/model/typedef/AttributeDefinition.java
+++ b/intg/src/main/java/org/apache/atlas/v1/model/typedef/AttributeDefinition.java
@@ -26,6 +26,8 @@ import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlRootElement;
 
 import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.Objects;
 
 import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
@@ -48,22 +50,23 @@ public class AttributeDefinition implements Serializable {
     private String       reverseAttributeName; // If this is a reference attribute, then
the name of the attribute on the Class that this refers to.
     private String       defaultValue;
     private String       description;
-
-
+    private Map<String, String> options;
 
     public AttributeDefinition() {
     }
 
     public AttributeDefinition(String name, String dataTypeName, Multiplicity multiplicity)
{
-        this(name, dataTypeName, multiplicity, false, false, true, null);
+        this(name, dataTypeName, multiplicity, false, false, true, null, null);
     }
 
     public AttributeDefinition(String name, String dataTypeName, Multiplicity multiplicity,
boolean isComposite,
                                String reverseAttributeName) {
-        this(name, dataTypeName, multiplicity, isComposite, false, false, reverseAttributeName);
+        this(name, dataTypeName, multiplicity, isComposite, false, false, reverseAttributeName,
null);
     }
 
-    public AttributeDefinition(String name, String dataTypeName, Multiplicity multiplicity,
boolean isComposite, boolean isUnique, boolean isIndexable, String reverseAttributeName) {
+    public AttributeDefinition(String name, String dataTypeName, Multiplicity multiplicity,
boolean isComposite,
+                               boolean isUnique, boolean isIndexable, String reverseAttributeName,
+                               Map<String, String> options) {
         this.name                 = name;
         this.dataTypeName         = dataTypeName;
         this.multiplicity         = multiplicity;
@@ -71,6 +74,7 @@ public class AttributeDefinition implements Serializable {
         this.isUnique             = isUnique;
         this.isIndexable          = isIndexable;
         this.reverseAttributeName = reverseAttributeName;
+        this.options              = options;
     }
 
 
@@ -146,6 +150,18 @@ public class AttributeDefinition implements Serializable {
         this.description = description;
     }
 
+    public Map<String, String> getOptions() {
+        return options;
+    }
+
+    public void setOptions(Map<String, String> options) {
+        if (options != null) {
+            this.options = new HashMap<>(options);
+        } else {
+            this.options = null;
+        }
+    }
+
     @Override
     public boolean equals(Object o) {
         if (this == o) {
@@ -166,12 +182,13 @@ public class AttributeDefinition implements Serializable {
                Objects.equals(multiplicity, that.multiplicity) &&
                Objects.equals(defaultValue, that.defaultValue) &&
                Objects.equals(description, that.description) &&
-               Objects.equals(reverseAttributeName, that.reverseAttributeName);
+               Objects.equals(reverseAttributeName, that.reverseAttributeName) &&
+                Objects.equals(options, that.options);
     }
 
     @Override
     public int hashCode() {
         return Objects.hash(name, dataTypeName, multiplicity, isComposite, isUnique, isIndexable,
-                            reverseAttributeName, defaultValue, description);
+                            reverseAttributeName, defaultValue, description, options);
     }
 }

http://git-wip-us.apache.org/repos/asf/atlas/blob/7952682a/intg/src/main/java/org/apache/atlas/v1/typesystem/types/utils/TypesUtil.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/v1/typesystem/types/utils/TypesUtil.java
b/intg/src/main/java/org/apache/atlas/v1/typesystem/types/utils/TypesUtil.java
index 864623a..70d3ff6 100644
--- a/intg/src/main/java/org/apache/atlas/v1/typesystem/types/utils/TypesUtil.java
+++ b/intg/src/main/java/org/apache/atlas/v1/typesystem/types/utils/TypesUtil.java
@@ -63,19 +63,19 @@ public class TypesUtil {
     }
 
     public static AttributeDefinition createUniqueRequiredAttrDef(String name, String dataTypeName)
{
-        AttributeDefinition ret = new AttributeDefinition(name, dataTypeName, Multiplicity.REQUIRED,
false, true, true, null);
+        AttributeDefinition ret = new AttributeDefinition(name, dataTypeName, Multiplicity.REQUIRED,
false, true, true, null, null);
 
         return ret;
     }
 
     public static AttributeDefinition createRequiredAttrDef(String name, String dataTypeName)
{
-        AttributeDefinition ret = new AttributeDefinition(name, dataTypeName, Multiplicity.REQUIRED,
false, false, true, null);
+        AttributeDefinition ret = new AttributeDefinition(name, dataTypeName, Multiplicity.REQUIRED,
false, false, true, null, null);
 
         return ret;
     }
 
     public static AttributeDefinition createOptionalAttrDef(String name, String dataTypeName)
{
-        AttributeDefinition ret = new AttributeDefinition(name, dataTypeName, Multiplicity.OPTIONAL,
false, false, true, null);
+        AttributeDefinition ret = new AttributeDefinition(name, dataTypeName, Multiplicity.OPTIONAL,
false, false, true, null, null);
 
         return ret;
     }

http://git-wip-us.apache.org/repos/asf/atlas/blob/7952682a/repository/src/main/java/org/apache/atlas/repository/converters/TypeConverterUtil.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/converters/TypeConverterUtil.java
b/repository/src/main/java/org/apache/atlas/repository/converters/TypeConverterUtil.java
index 40d9a07..caa63ee 100644
--- a/repository/src/main/java/org/apache/atlas/repository/converters/TypeConverterUtil.java
+++ b/repository/src/main/java/org/apache/atlas/repository/converters/TypeConverterUtil.java
@@ -362,7 +362,7 @@ public final class TypeConverterUtil {
 
                 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()));
+                ret.add(new AttributeDefinition(oldAttrDef.getName(), oldAttrDef.getDataTypeName(),
new Multiplicity(oldAttrDef.getMultiplicity()), oldAttrDef.getIsComposite(), oldAttrDef.getIsUnique(),
oldAttrDef.getIsIndexable(), oldAttrDef.getReverseAttributeName(), oldAttrDef.getOptions()));
             }
         }
 


Mime
View raw message