You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ma...@apache.org on 2016/11/09 07:54:11 UTC
incubator-atlas git commit: ATLAS-1278: Added API to get typedef
header info
Repository: incubator-atlas
Updated Branches:
refs/heads/master bf5f53a7f -> ee5b03cab
ATLAS-1278: Added API to get typedef header info
Signed-off-by: Madhan Neethiraj <ma...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/ee5b03ca
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/ee5b03ca
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/ee5b03ca
Branch: refs/heads/master
Commit: ee5b03cabcf20cbe72094f84d687252b17cf395d
Parents: bf5f53a
Author: apoorvnaik <an...@hortonworks.com>
Authored: Tue Nov 8 14:20:14 2016 -0800
Committer: Madhan Neethiraj <ma...@apache.org>
Committed: Tue Nov 8 23:13:33 2016 -0800
----------------------------------------------------------------------
.../org/apache/atlas/model/TypeCategory.java | 22 ++++
.../atlas/model/typedef/AtlasTypeDefHeader.java | 131 +++++++++++++++++++
.../org/apache/atlas/type/AtlasArrayType.java | 1 +
.../apache/atlas/type/AtlasBuiltInTypes.java | 1 +
.../atlas/type/AtlasClassificationType.java | 1 +
.../org/apache/atlas/type/AtlasEntityType.java | 1 +
.../org/apache/atlas/type/AtlasEnumType.java | 1 +
.../org/apache/atlas/type/AtlasMapType.java | 1 +
.../org/apache/atlas/type/AtlasStructType.java | 1 +
.../java/org/apache/atlas/type/AtlasType.java | 5 +-
.../org/apache/atlas/type/AtlasTypeUtil.java | 32 ++++-
release-log.txt | 1 +
.../graph/v1/AtlasClassificationDefStoreV1.java | 6 +-
.../store/graph/v1/AtlasEntityDefStoreV1.java | 6 +-
.../store/graph/v1/AtlasStructDefStoreV1.java | 10 +-
.../org/apache/atlas/web/rest/TypesREST.java | 18 +++
16 files changed, 222 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ee5b03ca/intg/src/main/java/org/apache/atlas/model/TypeCategory.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/model/TypeCategory.java b/intg/src/main/java/org/apache/atlas/model/TypeCategory.java
new file mode 100644
index 0000000..1da432e
--- /dev/null
+++ b/intg/src/main/java/org/apache/atlas/model/TypeCategory.java
@@ -0,0 +1,22 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas.model;
+
+public enum TypeCategory {
+ PRIMITIVE, ARRAY, MAP, ENTITY, STRUCT, CLASSIFICATION, OBJECT_ID_TYPE
+}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ee5b03ca/intg/src/main/java/org/apache/atlas/model/typedef/AtlasTypeDefHeader.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/model/typedef/AtlasTypeDefHeader.java b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasTypeDefHeader.java
new file mode 100644
index 0000000..b31b571
--- /dev/null
+++ b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasTypeDefHeader.java
@@ -0,0 +1,131 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas.model.typedef;
+
+import org.apache.atlas.model.TypeCategory;
+import org.codehaus.jackson.annotate.JsonAutoDetect;
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE;
+import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY;
+
+@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
+@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown=true)
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.PROPERTY)
+public class AtlasTypeDefHeader {
+ private String guid;
+ private String name;
+ private TypeCategory category;
+
+ public AtlasTypeDefHeader(String guid, String name, TypeCategory category) {
+ this.guid = guid;
+ this.name = name;
+ this.category = category;
+ }
+
+ public AtlasTypeDefHeader() {
+ this(null, null, null);
+ }
+
+ public AtlasTypeDefHeader(AtlasTypeDefHeader other) {
+ super();
+ if (other == null) {
+ setGuid(null);
+ setName(null);
+ setCategory(null);
+ } else {
+ setGuid(other.getGuid());
+ setName(other.getName());
+ setCategory(other.getCategory());
+ }
+ }
+
+ public String getGuid() {
+ return guid;
+ }
+
+ public void setGuid(String guid) {
+ this.guid = guid;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public TypeCategory getCategory() {
+ return category;
+ }
+
+ public void setCategory(TypeCategory category) {
+ this.category = category;
+ }
+
+
+ @Override
+ public String toString() {
+ return toString(new StringBuilder()).toString();
+ }
+
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) { return true; }
+ if (o == null || getClass() != o.getClass()) { return false; }
+
+ AtlasTypeDefHeader that = (AtlasTypeDefHeader) o;
+
+ if (guid != null ? !guid.equals(that.guid) : that.guid != null) { return false; }
+ if (name != null ? !name.equals(that.name) : that.name != null) { return false; }
+ if (category != null ? !category.equals(that.category) : that.category != null) { return false; }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = guid != null ? guid.hashCode() : 0;
+ result = 31 * result + (name != null ? name.hashCode() : 0);
+ result = 31 * result + (category != null ? category.hashCode() : 0);
+ return result;
+ }
+
+ public StringBuilder toString(StringBuilder sb) {
+ if (sb == null) {
+ sb = new StringBuilder();
+ }
+
+ sb.append("AtlasTypeDefHeader{");
+ sb.append("guid='").append(guid).append('\'');
+ sb.append(", name='").append(name).append('\'');
+ sb.append(", typeCategory='").append(category).append('\'');
+ sb.append('}');
+
+ return sb;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ee5b03ca/intg/src/main/java/org/apache/atlas/type/AtlasArrayType.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasArrayType.java b/intg/src/main/java/org/apache/atlas/type/AtlasArrayType.java
index e8092a5..156ed43 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasArrayType.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasArrayType.java
@@ -19,6 +19,7 @@ package org.apache.atlas.type;
import org.apache.atlas.exception.AtlasBaseException;
+import org.apache.atlas.model.TypeCategory;
import org.apache.atlas.model.typedef.AtlasBaseTypeDef;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ee5b03ca/intg/src/main/java/org/apache/atlas/type/AtlasBuiltInTypes.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasBuiltInTypes.java b/intg/src/main/java/org/apache/atlas/type/AtlasBuiltInTypes.java
index c7dad29..c135073 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasBuiltInTypes.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasBuiltInTypes.java
@@ -24,6 +24,7 @@ import java.text.ParseException;
import java.util.Date;
import java.util.Map;
+import org.apache.atlas.model.TypeCategory;
import org.apache.atlas.model.instance.AtlasObjectId;
import org.apache.atlas.model.typedef.AtlasBaseTypeDef;
import org.apache.commons.lang.StringUtils;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ee5b03ca/intg/src/main/java/org/apache/atlas/type/AtlasClassificationType.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasClassificationType.java b/intg/src/main/java/org/apache/atlas/type/AtlasClassificationType.java
index d841977..788617b 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasClassificationType.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasClassificationType.java
@@ -20,6 +20,7 @@ package org.apache.atlas.type;
import org.apache.atlas.AtlasErrorCode;
import org.apache.atlas.exception.AtlasBaseException;
+import org.apache.atlas.model.TypeCategory;
import org.apache.atlas.model.instance.AtlasClassification;
import org.apache.atlas.model.typedef.AtlasClassificationDef;
import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ee5b03ca/intg/src/main/java/org/apache/atlas/type/AtlasEntityType.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasEntityType.java b/intg/src/main/java/org/apache/atlas/type/AtlasEntityType.java
index 7170ee4..ab365f5 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasEntityType.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasEntityType.java
@@ -20,6 +20,7 @@ package org.apache.atlas.type;
import org.apache.atlas.AtlasErrorCode;
import org.apache.atlas.exception.AtlasBaseException;
+import org.apache.atlas.model.TypeCategory;
import org.apache.atlas.model.instance.AtlasEntity;
import org.apache.atlas.model.typedef.AtlasEntityDef;
import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ee5b03ca/intg/src/main/java/org/apache/atlas/type/AtlasEnumType.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasEnumType.java b/intg/src/main/java/org/apache/atlas/type/AtlasEnumType.java
index e9a2021..224696a 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasEnumType.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasEnumType.java
@@ -23,6 +23,7 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.atlas.exception.AtlasBaseException;
+import org.apache.atlas.model.TypeCategory;
import org.apache.atlas.model.typedef.AtlasEnumDef;
import org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumElementDef;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ee5b03ca/intg/src/main/java/org/apache/atlas/type/AtlasMapType.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasMapType.java b/intg/src/main/java/org/apache/atlas/type/AtlasMapType.java
index 0ebfa26..60899fd 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasMapType.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasMapType.java
@@ -19,6 +19,7 @@ package org.apache.atlas.type;
import org.apache.atlas.exception.AtlasBaseException;
+import org.apache.atlas.model.TypeCategory;
import org.apache.atlas.model.typedef.AtlasBaseTypeDef;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ee5b03ca/intg/src/main/java/org/apache/atlas/type/AtlasStructType.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasStructType.java b/intg/src/main/java/org/apache/atlas/type/AtlasStructType.java
index c8c2216..82c2e9e 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasStructType.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasStructType.java
@@ -19,6 +19,7 @@ package org.apache.atlas.type;
import org.apache.atlas.AtlasErrorCode;
import org.apache.atlas.exception.AtlasBaseException;
+import org.apache.atlas.model.TypeCategory;
import org.apache.atlas.model.instance.AtlasStruct;
import org.apache.atlas.model.typedef.AtlasStructDef;
import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef;
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ee5b03ca/intg/src/main/java/org/apache/atlas/type/AtlasType.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasType.java b/intg/src/main/java/org/apache/atlas/type/AtlasType.java
index a507bf4..5b6a289 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasType.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasType.java
@@ -21,6 +21,7 @@ package org.apache.atlas.type;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import org.apache.atlas.exception.AtlasBaseException;
+import org.apache.atlas.model.TypeCategory;
import org.apache.atlas.model.typedef.AtlasBaseTypeDef;
import java.util.List;
@@ -31,10 +32,6 @@ import java.util.List;
*/
public abstract class AtlasType {
- public enum TypeCategory {
- PRIMITIVE, ARRAY, MAP, ENTITY, STRUCT, CLASSIFICATION, OBJECT_ID_TYPE
- }
-
private static final Gson GSON =
new GsonBuilder().setDateFormat(AtlasBaseTypeDef.SERIALIZED_DATE_FORMAT_STR).create();
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ee5b03ca/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 a2f7463..24fd5b9 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java
@@ -27,16 +27,19 @@ import org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumElementDef;
import org.apache.atlas.model.typedef.AtlasStructDef;
import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef;
import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef.Cardinality;
+import org.apache.atlas.model.typedef.AtlasTypeDefHeader;
import org.apache.atlas.model.typedef.AtlasTypesDef;
+import org.apache.atlas.model.TypeCategory;
+import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.Arrays;
import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_ARRAY_PREFIX;
import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_ARRAY_SUFFIX;
@@ -194,4 +197,31 @@ public class AtlasTypeUtil {
List<AtlasEntityDef> classes) {
return new AtlasTypesDef(enums, structs, traits, classes);
}
+
+ public static List<AtlasTypeDefHeader> toTypeDefHeader(AtlasTypesDef typesDef) {
+ List<AtlasTypeDefHeader> headerList = new LinkedList<>();
+ if (CollectionUtils.isNotEmpty(typesDef.getEnumDefs())) {
+ for (AtlasEnumDef enumDef : typesDef.getEnumDefs()) {
+ headerList.add(new AtlasTypeDefHeader(enumDef.getGuid(), enumDef.getName(), TypeCategory.PRIMITIVE));
+ }
+ }
+ if (CollectionUtils.isNotEmpty(typesDef.getStructDefs())) {
+ for (AtlasStructDef structDef : typesDef.getStructDefs()) {
+ headerList.add(new AtlasTypeDefHeader(structDef.getGuid(), structDef.getName(), TypeCategory.STRUCT));
+ }
+ }
+ if (CollectionUtils.isNotEmpty(typesDef.getClassificationDefs())) {
+ for (AtlasClassificationDef classificationDef : typesDef.getClassificationDefs()) {
+ headerList.add(new AtlasTypeDefHeader(classificationDef.getGuid(), classificationDef.getName(),
+ TypeCategory.CLASSIFICATION));
+ }
+ }
+ if (CollectionUtils.isNotEmpty(typesDef.getEntityDefs())) {
+ for (AtlasEntityDef entityDef : typesDef.getEntityDefs()) {
+ headerList.add(new AtlasTypeDefHeader(entityDef.getGuid(), entityDef.getName(), TypeCategory.ENTITY));
+ }
+ }
+
+ return headerList;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ee5b03ca/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index ae93c1d..e1409a7 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -9,6 +9,7 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al
ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai)
ALL CHANGES:
+ATLAS-1278 Added API to get typedef header info
ATLAS-1246 Upgrade versions of dependencies (shwethags)
ATLAS-1192 Atlas IE support (kevalbhatt)
ATLAS-1273 Test testOnChangeRefresh in DefaultMetadataServiceTest is failing (ayubkhan via shwethags)
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ee5b03ca/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasClassificationDefStoreV1.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasClassificationDefStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasClassificationDefStoreV1.java
index 43f93d4..d34757c 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasClassificationDefStoreV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasClassificationDefStoreV1.java
@@ -58,7 +58,7 @@ public class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1 imple
AtlasType type = typeRegistry.getType(classificationDef.getName());
- if (type.getTypeCategory() != AtlasType.TypeCategory.CLASSIFICATION) {
+ if (type.getTypeCategory() != org.apache.atlas.model.TypeCategory.CLASSIFICATION) {
throw new AtlasBaseException(AtlasErrorCode.TYPE_MATCH_FAILED, classificationDef.getName(), TypeCategory.TRAIT.name());
}
@@ -193,7 +193,7 @@ public class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1 imple
AtlasType type = typeRegistry.getType(classificationDef.getName());
- if (type.getTypeCategory() != AtlasType.TypeCategory.CLASSIFICATION) {
+ if (type.getTypeCategory() != org.apache.atlas.model.TypeCategory.CLASSIFICATION) {
throw new AtlasBaseException(AtlasErrorCode.TYPE_MATCH_FAILED, classificationDef.getName(), TypeCategory.TRAIT.name());
}
@@ -223,7 +223,7 @@ public class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1 imple
AtlasType type = typeRegistry.getTypeByGuid(guid);
- if (type.getTypeCategory() != AtlasType.TypeCategory.CLASSIFICATION) {
+ if (type.getTypeCategory() != org.apache.atlas.model.TypeCategory.CLASSIFICATION) {
throw new AtlasBaseException(AtlasErrorCode.TYPE_MATCH_FAILED, classificationDef.getName(), TypeCategory.TRAIT.name());
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ee5b03ca/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1.java
index 5babae5..c7f6cdf 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1.java
@@ -57,7 +57,7 @@ public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
AtlasType type = typeRegistry.getType(entityDef.getName());
- if (type.getTypeCategory() != AtlasType.TypeCategory.ENTITY) {
+ if (type.getTypeCategory() != org.apache.atlas.model.TypeCategory.ENTITY) {
throw new AtlasBaseException(AtlasErrorCode.TYPE_MATCH_FAILED, entityDef.getName(), TypeCategory.CLASS.name());
}
@@ -191,7 +191,7 @@ public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
AtlasType type = typeRegistry.getType(entityDef.getName());
- if (type.getTypeCategory() != AtlasType.TypeCategory.ENTITY) {
+ if (type.getTypeCategory() != org.apache.atlas.model.TypeCategory.ENTITY) {
throw new AtlasBaseException(AtlasErrorCode.TYPE_MATCH_FAILED, entityDef.getName(), TypeCategory.CLASS.name());
}
@@ -221,7 +221,7 @@ public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
AtlasType type = typeRegistry.getTypeByGuid(guid);
- if (type.getTypeCategory() != AtlasType.TypeCategory.ENTITY) {
+ if (type.getTypeCategory() != org.apache.atlas.model.TypeCategory.ENTITY) {
throw new AtlasBaseException(AtlasErrorCode.TYPE_MATCH_FAILED, entityDef.getName(), TypeCategory.CLASS.name());
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ee5b03ca/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 6dfe8cf..ee36182 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
@@ -69,7 +69,7 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
AtlasType type = typeRegistry.getType(structDef.getName());
- if (type.getTypeCategory() != AtlasType.TypeCategory.STRUCT) {
+ if (type.getTypeCategory() != org.apache.atlas.model.TypeCategory.STRUCT) {
throw new AtlasBaseException(AtlasErrorCode.TYPE_MATCH_FAILED, structDef.getName(), TypeCategory.STRUCT.name());
}
@@ -202,7 +202,7 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
AtlasType type = typeRegistry.getType(structDef.getName());
- if (type.getTypeCategory() != AtlasType.TypeCategory.STRUCT) {
+ if (type.getTypeCategory() != org.apache.atlas.model.TypeCategory.STRUCT) {
throw new AtlasBaseException(AtlasErrorCode.TYPE_MATCH_FAILED, structDef.getName(), TypeCategory.STRUCT.name());
}
@@ -232,7 +232,7 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
AtlasType type = typeRegistry.getTypeByGuid(guid);
- if (type.getTypeCategory() != AtlasType.TypeCategory.STRUCT) {
+ if (type.getTypeCategory() != org.apache.atlas.model.TypeCategory.STRUCT) {
throw new AtlasBaseException(AtlasErrorCode.TYPE_MATCH_FAILED, structDef.getName(), TypeCategory.STRUCT.name());
}
@@ -494,11 +494,11 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
if (isForeignKey) { // check if the referenced entity has foreignKeyRef to this attribute
AtlasType attribType = structType.getAttributeType(attributeDef.getName());
- if (attribType.getTypeCategory() == AtlasType.TypeCategory.ARRAY) {
+ if (attribType.getTypeCategory() == org.apache.atlas.model.TypeCategory.ARRAY) {
attribType = ((AtlasArrayType)attribType).getElementType();
}
- if (attribType.getTypeCategory() == AtlasType.TypeCategory.ENTITY) {
+ if (attribType.getTypeCategory() == org.apache.atlas.model.TypeCategory.ENTITY) {
reverseAttribName = ((AtlasStructType)attribType).getMappedFromRefAttribute(structType.getTypeName(),
attributeDef.getName());
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/ee5b03ca/webapp/src/main/java/org/apache/atlas/web/rest/TypesREST.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/rest/TypesREST.java b/webapp/src/main/java/org/apache/atlas/web/rest/TypesREST.java
index d0cb209..867307f 100644
--- a/webapp/src/main/java/org/apache/atlas/web/rest/TypesREST.java
+++ b/webapp/src/main/java/org/apache/atlas/web/rest/TypesREST.java
@@ -29,13 +29,16 @@ import org.apache.atlas.model.typedef.AtlasEnumDef;
import org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumDefs;
import org.apache.atlas.model.typedef.AtlasStructDef;
import org.apache.atlas.model.typedef.AtlasStructDef.AtlasStructDefs;
+import org.apache.atlas.model.typedef.AtlasTypeDefHeader;
import org.apache.atlas.model.typedef.AtlasTypesDef;
import org.apache.atlas.store.AtlasTypeDefStore;
+import org.apache.atlas.type.AtlasTypeUtil;
import org.apache.atlas.web.util.Servlets;
import org.apache.http.annotation.Experimental;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.List;
import java.util.Set;
import javax.inject.Singleton;
@@ -387,6 +390,21 @@ public class TypesREST {
/** Bulk API operations **/
/******************************************************************/
+ /**
+ * Bulk retrieval API for all type definitions returned as a list of minimal information header
+ * @return List of AtlasTypeDefHeader {@link AtlasTypeDefHeader}
+ * @throws AtlasBaseException
+ */
+ @GET
+ @Path("/typedefs/headers")
+ @Produces(Servlets.JSON_MEDIA_TYPE)
+ public List<AtlasTypeDefHeader> getTypeDefHeaders() throws AtlasBaseException {
+ SearchFilter searchFilter = getSearchFilter();
+
+ AtlasTypesDef searchTypesDef = typeDefStore.searchTypesDef(searchFilter);
+
+ return AtlasTypeUtil.toTypeDefHeader(searchTypesDef);
+ }
/**
* Bulk retrieval API for retrieving all type definitions in Atlas