Commit 1d84cbbd by Suma Shivaprasad

ATLAS-1171 Structured, high-level public APIs - Fix JAXB issues with PList,…

ATLAS-1171 Structured, high-level public APIs - Fix JAXB issues with PList, SearchFilter (mneethiraj via sumasai)
parent adfdef02
......@@ -21,8 +21,10 @@ import java.util.List;
import java.util.Map;
import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.SearchFilter;
import org.apache.atlas.model.instance.AtlasClassification;
import org.apache.atlas.model.instance.AtlasEntity;
import org.apache.atlas.model.instance.AtlasEntity.AtlasEntities;
import org.apache.atlas.model.instance.AtlasObjectId;
/**
......@@ -39,7 +41,7 @@ public interface AtlasApiEntities {
void deleteEntity(AtlasObjectId objId) throws AtlasBaseException;
PList<AtlasEntity> searchEntities(SearchFilter filter) throws AtlasBaseException;
AtlasEntities searchEntities(SearchFilter filter) throws AtlasBaseException;
void addEntityClassification(AtlasObjectId entityId, AtlasClassification classification) throws AtlasBaseException;
......
......@@ -19,10 +19,15 @@ package org.apache.atlas.api;
import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.SearchFilter;
import org.apache.atlas.model.typedef.AtlasClassificationDef;
import org.apache.atlas.model.typedef.AtlasClassificationDef.AtlasClassificationDefs;
import org.apache.atlas.model.typedef.AtlasEntityDef;
import org.apache.atlas.model.typedef.AtlasEntityDef.AtlasEntityDefs;
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;
/**
* API to work with CRUD of Atlas types - enum/struct/classification/entity.
......@@ -42,7 +47,7 @@ public interface AtlasApiTypes {
void deleteEnumDefByGuid(String guid) throws AtlasBaseException;
PList<AtlasEnumDef> searchEnumDefs(SearchFilter filter) throws AtlasBaseException;
AtlasEnumDefs searchEnumDefs(SearchFilter filter) throws AtlasBaseException;
AtlasStructDef createStructDef(AtlasStructDef structDef) throws AtlasBaseException;
......@@ -59,7 +64,7 @@ public interface AtlasApiTypes {
void deleteStructDefByGuid(String guid) throws AtlasBaseException;
PList<AtlasStructDef> searchStructDefs(SearchFilter filter) throws AtlasBaseException;
AtlasStructDefs searchStructDefs(SearchFilter filter) throws AtlasBaseException;
AtlasClassificationDef createClassificationDef(AtlasClassificationDef classificationDef) throws AtlasBaseException;
......@@ -78,7 +83,7 @@ public interface AtlasApiTypes {
void deleteClassificationDefByGuid(String guid) throws AtlasBaseException;
PList<AtlasClassificationDef> searchClassificationDefs(SearchFilter filter) throws AtlasBaseException;
AtlasClassificationDefs searchClassificationDefs(SearchFilter filter) throws AtlasBaseException;
AtlasEntityDef createEntityDef(AtlasEntityDef entityDef) throws AtlasBaseException;
......@@ -95,5 +100,5 @@ public interface AtlasApiTypes {
void deleteEntityDefByGuid(String guid) throws AtlasBaseException;
PList<AtlasEntityDef> searchEntityDefs(SearchFilter filter) throws AtlasBaseException;
AtlasEntityDefs searchEntityDefs(SearchFilter filter) throws AtlasBaseException;
}
......@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.atlas.api;
package org.apache.atlas.model;
import java.util.List;
......@@ -25,14 +25,17 @@ import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.apache.atlas.api.SearchFilter.SortType;
import org.apache.atlas.model.SearchFilter.SortType;
import javax.xml.bind.annotation.XmlRootElement;
/**
* Paged-list, for returning search results.
* Paginated-list, for returning search results.
*/
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
@XmlRootElement
public class PList<T> implements java.io.Serializable {
private static final long serialVersionUID = 1L;
......@@ -46,6 +49,10 @@ public class PList<T> implements java.io.Serializable {
public PList() {
}
public PList(List<T> list) {
this(list, 0, list.size(), list.size(), SortType.NONE, null);
}
public PList(List<T> list, long startIndex, int pageSize, long totalCount, SortType sortType, String sortBy) {
setList(list);
setStartIndex(startIndex);
......@@ -55,13 +62,9 @@ public class PList<T> implements java.io.Serializable {
setSortBy(sortBy);
}
public List<T> getList() {
return list;
}
public void setList(List<T> list) { this.list = list; }
public void setList(List<T> list) {
this.list = list;
}
public List<T> getList() { return this.list; }
public long getStartIndex() {
return startIndex;
......@@ -109,13 +112,13 @@ public class PList<T> implements java.io.Serializable {
sb = new StringBuilder();
}
sb.append("PList<T>{");
sb.append("list='").append((list == null ? "null" : ("size:" + list.size()))).append('\'');
sb.append("PList{");
sb.append("listSize=").append((list == null ? 0 : list.size()));
sb.append(", startIndex=").append(startIndex);
sb.append(", pageSize=").append(pageSize);
sb.append(", totalCount=").append(totalCount);
sb.append(", sortType=").append(sortType);
sb.append(", version=").append(sortBy);
sb.append(", sortBy=").append(sortBy);
sb.append('}');
return sb;
......
......@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.atlas.api;
package org.apache.atlas.model;
import java.util.HashMap;
import java.util.Map;
......@@ -26,12 +26,15 @@ import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import javax.xml.bind.annotation.XmlRootElement;
/**
* Generic filter, to specify search criteria using name/value pairs.
*/
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
@XmlRootElement
public class SearchFilter {
/**
* to specify whether the result should be sorted? If yes, whether asc or desc.
......
......@@ -18,20 +18,28 @@
package org.apache.atlas.model.instance;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import org.apache.atlas.model.PList;
import org.apache.atlas.model.SearchFilter.SortType;
import org.codehaus.jackson.annotate.JsonAutoDetect;
import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY;
import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.map.annotate.JsonSerialize;
/**
* An instance of a classfication; it doesn't have an identity, this object exists only when associated with an entity.
* An instance of a classification; it doesn't have an identity, this object exists only when associated with an entity.
*/
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
@XmlRootElement
public class AtlasClassification extends AtlasStruct implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -57,4 +65,29 @@ public class AtlasClassification extends AtlasStruct implements Serializable {
setAttributes(other.getAttributes());
}
}
/**
* REST serialization friendly list.
*/
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
@XmlRootElement
@XmlSeeAlso(AtlasClassification.class)
public static class AtlasClassifications extends PList<AtlasClassification> {
private static final long serialVersionUID = 1L;
public AtlasClassifications() {
super();
}
public AtlasClassifications(List<AtlasClassification> list) {
super(list);
}
public AtlasClassifications(List list, long startIndex, int pageSize, long totalCount,
SortType sortType, String sortBy) {
super(list, startIndex, pageSize, totalCount, sortType, sortBy);
}
}
}
......@@ -19,8 +19,14 @@ package org.apache.atlas.model.instance;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import org.apache.atlas.model.PList;
import org.apache.atlas.model.SearchFilter.SortType;
import org.apache.atlas.model.typedef.AtlasEntityDef;
import org.codehaus.jackson.annotate.JsonAutoDetect;
import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY;
......@@ -35,6 +41,7 @@ import org.codehaus.jackson.map.annotate.JsonSerialize;
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
@XmlRootElement
public class AtlasEntity extends AtlasStruct implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -189,7 +196,7 @@ public class AtlasEntity extends AtlasStruct implements Serializable {
public int hashCode() {
int result = super.hashCode();
result = 31 * result + guid != null ? guid.hashCode() : 0;
result = 31 * result + (guid != null ? guid.hashCode() : 0);
result = 31 * result + (status != null ? status.hashCode() : 0);
result = 31 * result + (createdBy != null ? createdBy.hashCode() : 0);
result = 31 * result + (updatedBy != null ? updatedBy.hashCode() : 0);
......@@ -203,4 +210,29 @@ public class AtlasEntity extends AtlasStruct implements Serializable {
public String toString() {
return toString(new StringBuilder()).toString();
}
/**
* REST serialization friendly list.
*/
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
@XmlRootElement
@XmlSeeAlso(AtlasEntity.class)
public static class AtlasEntities extends PList<AtlasEntity> {
private static final long serialVersionUID = 1L;
public AtlasEntities() {
super();
}
public AtlasEntities(List<AtlasEntity> list) {
super(list);
}
public AtlasEntities(List list, long startIndex, int pageSize, long totalCount,
SortType sortType, String sortBy) {
super(list, startIndex, pageSize, totalCount, sortType, sortBy);
}
}
}
......@@ -18,8 +18,14 @@
package org.apache.atlas.model.instance;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import org.apache.atlas.model.PList;
import org.apache.atlas.model.SearchFilter.SortType;
import org.codehaus.jackson.annotate.JsonAutoDetect;
import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY;
import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE;
......@@ -32,6 +38,7 @@ import org.codehaus.jackson.map.annotate.JsonSerialize;
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
@XmlRootElement
public class AtlasObjectId implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -129,4 +136,30 @@ public class AtlasObjectId implements Serializable {
public String toString() {
return toString(new StringBuilder()).toString();
}
/**
* REST serialization friendly list.
*/
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
@XmlRootElement
@XmlSeeAlso(AtlasObjectId.class)
public static class AtlasObjectIds extends PList<AtlasObjectId> {
private static final long serialVersionUID = 1L;
public AtlasObjectIds() {
super();
}
public AtlasObjectIds(List<AtlasObjectId> list) {
super(list);
}
public AtlasObjectIds(List list, long startIndex, int pageSize, long totalCount,
SortType sortType, String sortBy) {
super(list, startIndex, pageSize, totalCount, sortType, sortBy);
}
}
}
......@@ -23,8 +23,14 @@ import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import org.apache.atlas.model.PList;
import org.apache.atlas.model.SearchFilter.SortType;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.codehaus.jackson.annotate.JsonAutoDetect;
......@@ -40,6 +46,7 @@ import org.codehaus.jackson.map.annotate.JsonSerialize;
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
@XmlRootElement
public class AtlasStruct implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -156,6 +163,32 @@ public class AtlasStruct implements Serializable {
}
/**
* REST serialization friendly list.
*/
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
@XmlRootElement
@XmlSeeAlso(AtlasStruct.class)
public static class AtlasStructs extends PList<AtlasStruct> {
private static final long serialVersionUID = 1L;
public AtlasStructs() {
super();
}
public AtlasStructs(List<AtlasStruct> list) {
super(list);
}
public AtlasStructs(List list, long startIndex, int pageSize, long totalCount,
SortType sortType, String sortBy) {
super(list, startIndex, pageSize, totalCount, sortType, sortBy);
}
}
public static StringBuilder dumpModelObjects(Collection<? extends AtlasStruct> objList, StringBuilder sb) {
if (sb == null) {
sb = new StringBuilder();
......
......@@ -23,6 +23,8 @@ import java.util.Collection;
import java.util.Date;
import java.util.Map;
import javax.xml.bind.annotation.XmlRootElement;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.codehaus.jackson.annotate.JsonAutoDetect;
......@@ -38,6 +40,7 @@ import org.codehaus.jackson.map.annotate.JsonSerialize;
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
@XmlRootElement
public abstract class AtlasBaseTypeDef implements java.io.Serializable {
private static final long serialVersionUID = 1L;
......
......@@ -22,6 +22,11 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import org.apache.atlas.model.PList;
import org.apache.atlas.model.SearchFilter.SortType;
import org.apache.commons.collections.CollectionUtils;
import org.codehaus.jackson.annotate.JsonAutoDetect;
import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY;
......@@ -36,6 +41,7 @@ import org.codehaus.jackson.map.annotate.JsonSerialize;
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
@XmlRootElement
public class AtlasClassificationDef extends AtlasStructDef implements java.io.Serializable {
private static final long serialVersionUID = 1L;
......@@ -166,4 +172,31 @@ public class AtlasClassificationDef extends AtlasStructDef implements java.io.Se
public String toString() {
return toString(new StringBuilder()).toString();
}
/**
* REST serialization friendly list.
*/
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
@XmlRootElement
@XmlSeeAlso(AtlasClassificationDef.class)
public static class AtlasClassificationDefs extends PList<AtlasClassificationDef> {
private static final long serialVersionUID = 1L;
public AtlasClassificationDefs() {
super();
}
public AtlasClassificationDefs(List<AtlasClassificationDef> list) {
super(list);
}
public AtlasClassificationDefs(List list, long startIndex, int pageSize, long totalCount,
SortType sortType, String sortBy) {
super(list, startIndex, pageSize, totalCount, sortType, sortBy);
}
}
}
......@@ -22,6 +22,11 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import org.apache.atlas.model.PList;
import org.apache.atlas.model.SearchFilter.SortType;
import org.apache.commons.collections.CollectionUtils;
import org.codehaus.jackson.annotate.JsonAutoDetect;
import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY;
......@@ -36,6 +41,7 @@ import org.codehaus.jackson.map.annotate.JsonSerialize;
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
@XmlRootElement
public class AtlasEntityDef extends AtlasStructDef implements java.io.Serializable {
private static final long serialVersionUID = 1L;
......@@ -163,4 +169,30 @@ public class AtlasEntityDef extends AtlasStructDef implements java.io.Serializab
public String toString() {
return toString(new StringBuilder()).toString();
}
/**
* REST serialization friendly list.
*/
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
@XmlRootElement
@XmlSeeAlso(AtlasEntityDef.class)
public static class AtlasEntityDefs extends PList<AtlasEntityDef> {
private static final long serialVersionUID = 1L;
public AtlasEntityDefs() {
super();
}
public AtlasEntityDefs(List<AtlasEntityDef> list) {
super(list);
}
public AtlasEntityDefs(List list, long startIndex, int pageSize, long totalCount,
SortType sortType, String sortBy) {
super(list, startIndex, pageSize, totalCount, sortType, sortBy);
}
}
}
......@@ -20,6 +20,11 @@ package org.apache.atlas.model.typedef;
import java.io.Serializable;
import java.util.*;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import org.apache.atlas.model.PList;
import org.apache.atlas.model.SearchFilter.SortType;
import org.apache.commons.collections.CollectionUtils;
import org.apache.hadoop.util.StringUtils;
import org.codehaus.jackson.annotate.JsonAutoDetect;
......@@ -35,6 +40,7 @@ import org.codehaus.jackson.map.annotate.JsonSerialize;
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
@XmlRootElement
public class AtlasEnumDef extends AtlasBaseTypeDef implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -240,6 +246,7 @@ public class AtlasEnumDef extends AtlasBaseTypeDef implements Serializable {
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
@XmlRootElement
public static class AtlasEnumElementDef implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -332,4 +339,30 @@ public class AtlasEnumDef extends AtlasBaseTypeDef implements Serializable {
return toString(new StringBuilder()).toString();
}
}
/**
* REST serialization friendly list.
*/
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
@XmlRootElement
@XmlSeeAlso(AtlasEnumDef.class)
public static class AtlasEnumDefs extends PList<AtlasEnumDef> {
private static final long serialVersionUID = 1L;
public AtlasEnumDefs() {
super();
}
public AtlasEnumDefs(List<AtlasEnumDef> list) {
super(list);
}
public AtlasEnumDefs(List list, long startIndex, int pageSize, long totalCount,
SortType sortType, String sortBy) {
super(list, startIndex, pageSize, totalCount, sortType, sortBy);
}
}
}
......@@ -25,6 +25,11 @@ import java.util.List;
import java.util.ListIterator;
import java.util.Set;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import org.apache.atlas.model.PList;
import org.apache.atlas.model.SearchFilter.SortType;
import org.apache.commons.collections.CollectionUtils;
import org.apache.hadoop.util.StringUtils;
import org.codehaus.jackson.annotate.JsonAutoDetect;
......@@ -40,6 +45,7 @@ import org.codehaus.jackson.map.annotate.JsonSerialize;
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
@XmlRootElement
public class AtlasStructDef extends AtlasBaseTypeDef implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -226,6 +232,7 @@ public class AtlasStructDef extends AtlasBaseTypeDef implements Serializable {
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonSerialize(include= JsonSerialize.Inclusion.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
@XmlRootElement
public static class AtlasAttributeDef implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -398,4 +405,30 @@ public class AtlasStructDef extends AtlasBaseTypeDef implements Serializable {
return toString(new StringBuilder()).toString();
}
}
/**
* REST serialization friendly list.
*/
@JsonAutoDetect(getterVisibility=PUBLIC_ONLY, setterVisibility=PUBLIC_ONLY, fieldVisibility=NONE)
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown=true)
@XmlRootElement
@XmlSeeAlso(AtlasStructDef.class)
public static class AtlasStructDefs extends PList<AtlasStructDef> {
private static final long serialVersionUID = 1L;
public AtlasStructDefs() {
super();
}
public AtlasStructDefs(List<AtlasStructDef> list) {
super(list);
}
public AtlasStructDefs(List list, long startIndex, int pageSize, long totalCount,
SortType sortType, String sortBy) {
super(list, startIndex, pageSize, totalCount, sortType, sortBy);
}
}
}
......@@ -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-1171 Structured, high-level public APIs - Fix JAXB issues with PList, SearchFilter (mneethiraj via sumasai)
ATLAS-1206 Atlas UI not working with IE or Chrome on Windows OS in Kerberos mode (nixonrodrigues via sumasai)
ATLAS-1205 Improve atlas build time (shwethags)
ATLAS-1203 'Invalid type definition' due to no new types to be created at startup (mneethiraj via shwethags)
......
......@@ -27,12 +27,15 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import org.apache.atlas.api.PList;
import org.apache.atlas.api.SearchFilter;
import org.apache.atlas.model.SearchFilter;
import org.apache.atlas.model.typedef.AtlasClassificationDef;
import org.apache.atlas.model.typedef.AtlasClassificationDef.AtlasClassificationDefs;
import org.apache.atlas.model.typedef.AtlasEntityDef;
import org.apache.atlas.model.typedef.AtlasEntityDef.AtlasEntityDefs;
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.web.util.Servlets;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -114,8 +117,8 @@ public class TypesREST {
@GET
@Path("/enumdef")
@Produces(Servlets.JSON_MEDIA_TYPE)
public PList<AtlasEnumDef> searchEnumDefs(@Context HttpServletRequest request) throws Exception {
PList<AtlasEnumDef> ret = null;
public AtlasEnumDefs searchEnumDefs(@Context HttpServletRequest request) throws Exception {
AtlasEnumDefs ret = null;
// TODO: SearchFilter filter = getSearchFilter(request);
// TODO: ret = store.searchEnumDefs(filter);
......@@ -196,8 +199,8 @@ public class TypesREST {
@GET
@Path("/structdef")
@Produces(Servlets.JSON_MEDIA_TYPE)
public PList<AtlasStructDef> searchStructDefs(@Context HttpServletRequest request) throws Exception {
PList<AtlasStructDef> ret = null;
public AtlasStructDefs searchStructDefs(@Context HttpServletRequest request) throws Exception {
AtlasStructDefs ret = null;
// TODO: SearchFilter filter = getSearchFilter(request);
// TODO: ret = store.searchStructDefs(filter);
......@@ -278,8 +281,8 @@ public class TypesREST {
@GET
@Path("/classificationdef")
@Produces(Servlets.JSON_MEDIA_TYPE)
public PList<AtlasClassificationDef> searchClassificationDefs(SearchFilter filter) throws Exception {
PList<AtlasClassificationDef> ret = null;
public AtlasClassificationDefs searchClassificationDefs(SearchFilter filter) throws Exception {
AtlasClassificationDefs ret = null;
// TODO: SearchFilter filter = getSearchFilter(request);
// TODO: ret = store.searchClassificationDefs(filter);
......@@ -360,8 +363,8 @@ public class TypesREST {
@GET
@Path("/entitydef")
@Produces(Servlets.JSON_MEDIA_TYPE)
public PList<AtlasEntityDef> searchEntityDefs(SearchFilter filter) throws Exception {
PList<AtlasEntityDef> ret = null;
public AtlasEntityDefs searchEntityDefs(SearchFilter filter) throws Exception {
AtlasEntityDefs ret = null;
// TODO: SearchFilter filter = getSearchFilter(request);
// TODO: ret = store.searchEntityDefs(filter);
......
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