Commit ee5b03ca by apoorvnaik Committed by Madhan Neethiraj

ATLAS-1278: Added API to get typedef header info

parent bf5f53a7
/**
* 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
}
/**
* 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;
}
}
...@@ -19,6 +19,7 @@ package org.apache.atlas.type; ...@@ -19,6 +19,7 @@ package org.apache.atlas.type;
import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.TypeCategory;
import org.apache.atlas.model.typedef.AtlasBaseTypeDef; import org.apache.atlas.model.typedef.AtlasBaseTypeDef;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
......
...@@ -24,6 +24,7 @@ import java.text.ParseException; ...@@ -24,6 +24,7 @@ import java.text.ParseException;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;
import org.apache.atlas.model.TypeCategory;
import org.apache.atlas.model.instance.AtlasObjectId; import org.apache.atlas.model.instance.AtlasObjectId;
import org.apache.atlas.model.typedef.AtlasBaseTypeDef; import org.apache.atlas.model.typedef.AtlasBaseTypeDef;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
......
...@@ -20,6 +20,7 @@ package org.apache.atlas.type; ...@@ -20,6 +20,7 @@ package org.apache.atlas.type;
import org.apache.atlas.AtlasErrorCode; import org.apache.atlas.AtlasErrorCode;
import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.TypeCategory;
import org.apache.atlas.model.instance.AtlasClassification; import org.apache.atlas.model.instance.AtlasClassification;
import org.apache.atlas.model.typedef.AtlasClassificationDef; import org.apache.atlas.model.typedef.AtlasClassificationDef;
import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef; import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef;
......
...@@ -20,6 +20,7 @@ package org.apache.atlas.type; ...@@ -20,6 +20,7 @@ package org.apache.atlas.type;
import org.apache.atlas.AtlasErrorCode; import org.apache.atlas.AtlasErrorCode;
import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.TypeCategory;
import org.apache.atlas.model.instance.AtlasEntity; import org.apache.atlas.model.instance.AtlasEntity;
import org.apache.atlas.model.typedef.AtlasEntityDef; import org.apache.atlas.model.typedef.AtlasEntityDef;
import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef; import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef;
......
...@@ -23,6 +23,7 @@ import java.util.HashMap; ...@@ -23,6 +23,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.apache.atlas.exception.AtlasBaseException; 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;
import org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumElementDef; import org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumElementDef;
......
...@@ -19,6 +19,7 @@ package org.apache.atlas.type; ...@@ -19,6 +19,7 @@ package org.apache.atlas.type;
import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.TypeCategory;
import org.apache.atlas.model.typedef.AtlasBaseTypeDef; import org.apache.atlas.model.typedef.AtlasBaseTypeDef;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
......
...@@ -19,6 +19,7 @@ package org.apache.atlas.type; ...@@ -19,6 +19,7 @@ package org.apache.atlas.type;
import org.apache.atlas.AtlasErrorCode; import org.apache.atlas.AtlasErrorCode;
import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.TypeCategory;
import org.apache.atlas.model.instance.AtlasStruct; import org.apache.atlas.model.instance.AtlasStruct;
import org.apache.atlas.model.typedef.AtlasStructDef; import org.apache.atlas.model.typedef.AtlasStructDef;
import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef; import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef;
......
...@@ -21,6 +21,7 @@ package org.apache.atlas.type; ...@@ -21,6 +21,7 @@ package org.apache.atlas.type;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.TypeCategory;
import org.apache.atlas.model.typedef.AtlasBaseTypeDef; import org.apache.atlas.model.typedef.AtlasBaseTypeDef;
import java.util.List; import java.util.List;
...@@ -31,10 +32,6 @@ import java.util.List; ...@@ -31,10 +32,6 @@ import java.util.List;
*/ */
public abstract class AtlasType { public abstract class AtlasType {
public enum TypeCategory {
PRIMITIVE, ARRAY, MAP, ENTITY, STRUCT, CLASSIFICATION, OBJECT_ID_TYPE
}
private static final Gson GSON = private static final Gson GSON =
new GsonBuilder().setDateFormat(AtlasBaseTypeDef.SERIALIZED_DATE_FORMAT_STR).create(); new GsonBuilder().setDateFormat(AtlasBaseTypeDef.SERIALIZED_DATE_FORMAT_STR).create();
......
...@@ -27,16 +27,19 @@ import org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumElementDef; ...@@ -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;
import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef; import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef;
import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef.Cardinality; 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.typedef.AtlasTypesDef;
import org.apache.atlas.model.TypeCategory;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; 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_PREFIX;
import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_ARRAY_SUFFIX; import static org.apache.atlas.model.typedef.AtlasBaseTypeDef.ATLAS_TYPE_ARRAY_SUFFIX;
...@@ -194,4 +197,31 @@ public class AtlasTypeUtil { ...@@ -194,4 +197,31 @@ public class AtlasTypeUtil {
List<AtlasEntityDef> classes) { List<AtlasEntityDef> classes) {
return new AtlasTypesDef(enums, structs, traits, 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
...@@ -9,6 +9,7 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al ...@@ -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) ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai)
ALL CHANGES: ALL CHANGES:
ATLAS-1278 Added API to get typedef header info
ATLAS-1246 Upgrade versions of dependencies (shwethags) ATLAS-1246 Upgrade versions of dependencies (shwethags)
ATLAS-1192 Atlas IE support (kevalbhatt) ATLAS-1192 Atlas IE support (kevalbhatt)
ATLAS-1273 Test testOnChangeRefresh in DefaultMetadataServiceTest is failing (ayubkhan via shwethags) ATLAS-1273 Test testOnChangeRefresh in DefaultMetadataServiceTest is failing (ayubkhan via shwethags)
......
...@@ -58,7 +58,7 @@ public class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1 imple ...@@ -58,7 +58,7 @@ public class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1 imple
AtlasType type = typeRegistry.getType(classificationDef.getName()); 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()); throw new AtlasBaseException(AtlasErrorCode.TYPE_MATCH_FAILED, classificationDef.getName(), TypeCategory.TRAIT.name());
} }
...@@ -193,7 +193,7 @@ public class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1 imple ...@@ -193,7 +193,7 @@ public class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1 imple
AtlasType type = typeRegistry.getType(classificationDef.getName()); 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()); throw new AtlasBaseException(AtlasErrorCode.TYPE_MATCH_FAILED, classificationDef.getName(), TypeCategory.TRAIT.name());
} }
...@@ -223,7 +223,7 @@ public class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1 imple ...@@ -223,7 +223,7 @@ public class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1 imple
AtlasType type = typeRegistry.getTypeByGuid(guid); 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()); throw new AtlasBaseException(AtlasErrorCode.TYPE_MATCH_FAILED, classificationDef.getName(), TypeCategory.TRAIT.name());
} }
......
...@@ -57,7 +57,7 @@ public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1 implements At ...@@ -57,7 +57,7 @@ public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
AtlasType type = typeRegistry.getType(entityDef.getName()); 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()); throw new AtlasBaseException(AtlasErrorCode.TYPE_MATCH_FAILED, entityDef.getName(), TypeCategory.CLASS.name());
} }
...@@ -191,7 +191,7 @@ public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1 implements At ...@@ -191,7 +191,7 @@ public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
AtlasType type = typeRegistry.getType(entityDef.getName()); 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()); throw new AtlasBaseException(AtlasErrorCode.TYPE_MATCH_FAILED, entityDef.getName(), TypeCategory.CLASS.name());
} }
...@@ -221,7 +221,7 @@ public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1 implements At ...@@ -221,7 +221,7 @@ public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
AtlasType type = typeRegistry.getTypeByGuid(guid); 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()); throw new AtlasBaseException(AtlasErrorCode.TYPE_MATCH_FAILED, entityDef.getName(), TypeCategory.CLASS.name());
} }
......
...@@ -69,7 +69,7 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At ...@@ -69,7 +69,7 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
AtlasType type = typeRegistry.getType(structDef.getName()); 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()); throw new AtlasBaseException(AtlasErrorCode.TYPE_MATCH_FAILED, structDef.getName(), TypeCategory.STRUCT.name());
} }
...@@ -202,7 +202,7 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At ...@@ -202,7 +202,7 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
AtlasType type = typeRegistry.getType(structDef.getName()); 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()); throw new AtlasBaseException(AtlasErrorCode.TYPE_MATCH_FAILED, structDef.getName(), TypeCategory.STRUCT.name());
} }
...@@ -232,7 +232,7 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At ...@@ -232,7 +232,7 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
AtlasType type = typeRegistry.getTypeByGuid(guid); 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()); throw new AtlasBaseException(AtlasErrorCode.TYPE_MATCH_FAILED, structDef.getName(), TypeCategory.STRUCT.name());
} }
...@@ -494,11 +494,11 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At ...@@ -494,11 +494,11 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
if (isForeignKey) { // check if the referenced entity has foreignKeyRef to this attribute if (isForeignKey) { // check if the referenced entity has foreignKeyRef to this attribute
AtlasType attribType = structType.getAttributeType(attributeDef.getName()); 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(); 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(), reverseAttribName = ((AtlasStructType)attribType).getMappedFromRefAttribute(structType.getTypeName(),
attributeDef.getName()); attributeDef.getName());
} }
......
...@@ -29,13 +29,16 @@ import org.apache.atlas.model.typedef.AtlasEnumDef; ...@@ -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.AtlasEnumDef.AtlasEnumDefs;
import org.apache.atlas.model.typedef.AtlasStructDef; import org.apache.atlas.model.typedef.AtlasStructDef;
import org.apache.atlas.model.typedef.AtlasStructDef.AtlasStructDefs; 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.model.typedef.AtlasTypesDef;
import org.apache.atlas.store.AtlasTypeDefStore; import org.apache.atlas.store.AtlasTypeDefStore;
import org.apache.atlas.type.AtlasTypeUtil;
import org.apache.atlas.web.util.Servlets; import org.apache.atlas.web.util.Servlets;
import org.apache.http.annotation.Experimental; import org.apache.http.annotation.Experimental;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.Set; import java.util.Set;
import javax.inject.Singleton; import javax.inject.Singleton;
...@@ -387,6 +390,21 @@ public class TypesREST { ...@@ -387,6 +390,21 @@ public class TypesREST {
/** Bulk API operations **/ /** 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 * Bulk retrieval API for retrieving all type definitions in Atlas
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment