Fix for generating correct REST API docs

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

Branch: refs/heads/branch-1.0
Commit: 6973830c8e50642c53d922709170333acbaed0a2
Parents: 314569d
Author: apoorvnaik <apoorvn...@apache.org>
Authored: Mon Oct 22 09:22:45 2018 -0700
Committer: Ashutosh Mestry <ames...@hortonworks.com>
Committed: Thu Nov 1 15:42:58 2018 -0700

----------------------------------------------------------------------
 build-tools/src/main/resources/enunciate.xml    |  8 ++--
 pom.xml                                         |  4 +-
 .../apache/atlas/web/rest/DiscoveryREST.java    | 29 ++------------
 .../org/apache/atlas/web/rest/EntityREST.java   | 41 +-------------------
 .../org/apache/atlas/web/rest/GlossaryREST.java |  7 ++--
 .../org/apache/atlas/web/rest/LineageREST.java  |  6 +--
 .../apache/atlas/web/rest/RelationshipREST.java | 22 ++---------
 .../org/apache/atlas/web/rest/TypesREST.java    | 35 ++++++-----------
 8 files changed, 32 insertions(+), 120 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/6973830c/build-tools/src/main/resources/enunciate.xml
----------------------------------------------------------------------
diff --git a/build-tools/src/main/resources/enunciate.xml 
b/build-tools/src/main/resources/enunciate.xml
index dafd66f..e01d696 100755
--- a/build-tools/src/main/resources/enunciate.xml
+++ b/build-tools/src/main/resources/enunciate.xml
@@ -16,8 +16,7 @@
   ~ limitations under the License.
   -->
 
-<enunciate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-           
xsi:noNamespaceSchemaLocation="http://enunciate.webcohesion.com/schemas/enunciate-2.8.0.xsd";>
+<enunciate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:noNamespaceSchemaLocation="http://enunciate.webcohesion.com/schemas/enunciate-2.11.0.xsd";>
     <title>Atlas REST API</title>
     <description> Atlas exposes a variety of REST endpoints to work with 
types, entities, lineage and data discovery.</description>
     <api-classes>
@@ -26,8 +25,9 @@
     </api-classes>
 
     <modules>
-        <swagger/>
-        <jackson/>
+        <swagger host="localhost:21000"/>
+        <jackson datatype-detection="aggressive" propertiesAlphabetical="true" 
honorJaxb="false"/>
+        <jaxrs datatype-detection="aggressive"/>
         <jackson1 disabled="true"/>
         <c-xml-client disabled="true"/>
         <java-json-client disabled="true"/>

http://git-wip-us.apache.org/repos/asf/atlas/blob/6973830c/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 2b1956f..a3437f5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -683,7 +683,7 @@
         <jettison.version>1.3.7</jettison.version>
         <paranamer.version>2.7</paranamer.version>
         <zkclient.version>0.8</zkclient.version>
-        <enunciate-maven-plugin.version>2.10.1</enunciate-maven-plugin.version>
+        <enunciate-maven-plugin.version>2.11.1</enunciate-maven-plugin.version>
         <antlr4.plugin.version>4.5</antlr4.plugin.version>
         <maven-site-plugin.version>3.7</maven-site-plugin.version>
         <doxia.version>1.8</doxia.version>
@@ -706,7 +706,7 @@
         <skipITs>false</skipITs>
         <skipDocs>true</skipDocs>
         <skipSite>true</skipSite>
-        <skipEnunciate>true</skipEnunciate>
+        <skipEnunciate>false</skipEnunciate>
         <projectBaseDir>${project.basedir}</projectBaseDir>
         <jetty-maven-plugin.stopWait>10</jetty-maven-plugin.stopWait>
 

http://git-wip-us.apache.org/repos/asf/atlas/blob/6973830c/webapp/src/main/java/org/apache/atlas/web/rest/DiscoveryREST.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/rest/DiscoveryREST.java 
b/webapp/src/main/java/org/apache/atlas/web/rest/DiscoveryREST.java
index 82d6f35..64da211 100644
--- a/webapp/src/main/java/org/apache/atlas/web/rest/DiscoveryREST.java
+++ b/webapp/src/main/java/org/apache/atlas/web/rest/DiscoveryREST.java
@@ -51,6 +51,7 @@ import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
 import java.io.IOException;
 import java.util.List;
 
@@ -60,6 +61,8 @@ import java.util.List;
 @Path("v2/search")
 @Singleton
 @Service
+@Consumes({Servlets.JSON_MEDIA_TYPE, MediaType.APPLICATION_JSON})
+@Produces({Servlets.JSON_MEDIA_TYPE, MediaType.APPLICATION_JSON})
 public class DiscoveryREST {
     private static final Logger PERF_LOG = 
AtlasPerfTracer.getPerfLogger("rest.DiscoveryREST");
 
@@ -95,8 +98,6 @@ public class DiscoveryREST {
      */
     @GET
     @Path("/dsl")
-    @Consumes(Servlets.JSON_MEDIA_TYPE)
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasSearchResult searchUsingDSL(@QueryParam("query")          
String query,
                                             @QueryParam("typeName")       
String typeName,
                                             @QueryParam("classification") 
String classification,
@@ -144,8 +145,6 @@ public class DiscoveryREST {
      */
     @GET
     @Path("/fulltext")
-    @Consumes(Servlets.JSON_MEDIA_TYPE)
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasSearchResult searchUsingFullText(@QueryParam("query")          
        String  query,
                                                  
@QueryParam("excludeDeletedEntities") boolean excludeDeletedEntities,
                                                  @QueryParam("limit")          
        int     limit,
@@ -185,8 +184,6 @@ public class DiscoveryREST {
      */
     @GET
     @Path("/basic")
-    @Consumes(Servlets.JSON_MEDIA_TYPE)
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasSearchResult searchUsingBasic(@QueryParam("query")             
     String  query,
                                               @QueryParam("typeName")          
     String  typeName,
                                               @QueryParam("classification")    
     String  classification,
@@ -237,8 +234,6 @@ public class DiscoveryREST {
      */
     @GET
     @Path("/attribute")
-    @Consumes(Servlets.JSON_MEDIA_TYPE)
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasSearchResult searchUsingAttribute(@QueryParam("attrName")      
  String attrName,
                                                   
@QueryParam("attrValuePrefix") String attrValuePrefix,
                                                   @QueryParam("typeName")      
  String typeName,
@@ -312,8 +307,6 @@ public class DiscoveryREST {
      */
     @Path("basic")
     @POST
-    @Consumes(Servlets.JSON_MEDIA_TYPE)
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasSearchResult searchWithParameters(SearchParameters parameters) 
throws AtlasBaseException {
         AtlasPerfTracer perf = null;
 
@@ -362,8 +355,6 @@ public class DiscoveryREST {
      */
     @GET
     @Path("relationship")
-    @Consumes(Servlets.JSON_MEDIA_TYPE)
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasSearchResult searchRelatedEntities(@QueryParam("guid")         
          String    guid,
                                                    @QueryParam("relation")     
          String    relation,
                                                    @QueryParam("sortBy")       
          String    sortByAttribute,
@@ -397,8 +388,6 @@ public class DiscoveryREST {
      */
     @POST
     @Path("saved")
-    @Consumes(Servlets.JSON_MEDIA_TYPE)
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasUserSavedSearch addSavedSearch(AtlasUserSavedSearch 
savedSearch) throws AtlasBaseException, IOException {
         validateUserSavedSearch(savedSearch);
 
@@ -423,8 +412,6 @@ public class DiscoveryREST {
      */
     @PUT
     @Path("saved")
-    @Consumes(Servlets.JSON_MEDIA_TYPE)
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasUserSavedSearch updateSavedSearch(AtlasUserSavedSearch 
savedSearch) throws AtlasBaseException {
         validateUserSavedSearch(savedSearch);
 
@@ -450,8 +437,6 @@ public class DiscoveryREST {
      */
     @GET
     @Path("saved/{name}")
-    @Consumes(Servlets.JSON_MEDIA_TYPE)
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasUserSavedSearch getSavedSearch(@PathParam("name") String 
searchName,
                                                @QueryParam("user") String 
userName) throws AtlasBaseException {
         Servlets.validateQueryParamLength("name", searchName);
@@ -478,8 +463,6 @@ public class DiscoveryREST {
      */
     @GET
     @Path("saved")
-    @Consumes(Servlets.JSON_MEDIA_TYPE)
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public List<AtlasUserSavedSearch> getSavedSearches(@QueryParam("user") 
String userName) throws AtlasBaseException {
         Servlets.validateQueryParamLength("user", userName);
 
@@ -501,8 +484,6 @@ public class DiscoveryREST {
      */
     @DELETE
     @Path("saved/{guid}")
-    @Consumes(Servlets.JSON_MEDIA_TYPE)
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public void deleteSavedSearch(@PathParam("guid") String guid) throws 
AtlasBaseException {
         Servlets.validateQueryParamLength("guid", guid);
 
@@ -530,8 +511,6 @@ public class DiscoveryREST {
      */
     @Path("saved/execute/{name}")
     @GET
-    @Consumes(Servlets.JSON_MEDIA_TYPE)
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasSearchResult executeSavedSearchByName(@PathParam("name") 
String searchName,
                                                       @QueryParam("user") 
String userName) throws AtlasBaseException {
         Servlets.validateQueryParamLength("name", searchName);
@@ -562,8 +541,6 @@ public class DiscoveryREST {
      */
     @Path("saved/execute/guid/{guid}")
     @GET
-    @Consumes(Servlets.JSON_MEDIA_TYPE)
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasSearchResult executeSavedSearchByGuid(@PathParam("guid") 
String searchGuid) throws AtlasBaseException {
         Servlets.validateQueryParamLength("guid", searchGuid);
 

http://git-wip-us.apache.org/repos/asf/atlas/blob/6973830c/webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java 
b/webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java
index 5747f92..68c132c 100644
--- a/webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java
+++ b/webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java
@@ -53,7 +53,6 @@ import javax.ws.rs.*;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -65,6 +64,8 @@ import java.util.Map;
 @Path("v2/entity")
 @Singleton
 @Service
+@Consumes({Servlets.JSON_MEDIA_TYPE, MediaType.APPLICATION_JSON})
+@Produces({Servlets.JSON_MEDIA_TYPE, MediaType.APPLICATION_JSON})
 public class EntityREST {
     private static final Logger LOG      = 
LoggerFactory.getLogger(EntityREST.class);
     private static final Logger PERF_LOG = 
AtlasPerfTracer.getPerfLogger("rest.EntityREST");
@@ -94,8 +95,6 @@ public class EntityREST {
      */
     @GET
     @Path("/guid/{guid}")
-    @Consumes(Servlets.JSON_MEDIA_TYPE)
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasEntityWithExtInfo getById(@PathParam("guid") String guid, 
@QueryParam("minExtInfo") @DefaultValue("false") boolean minExtInfo) throws 
AtlasBaseException {
         Servlets.validateQueryParamLength("guid", guid);
 
@@ -120,8 +119,6 @@ public class EntityREST {
      */
     @GET
     @Path("/guid/{guid}/header")
-    @Consumes(Servlets.JSON_MEDIA_TYPE)
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasEntityHeader getHeaderById(@PathParam("guid") String guid) 
throws AtlasBaseException {
         Servlets.validateQueryParamLength("guid", guid);
 
@@ -157,8 +154,6 @@ public class EntityREST {
      */
     @GET
     @Path("/uniqueAttribute/type/{typeName}")
-    @Consumes(Servlets.JSON_MEDIA_TYPE)
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasEntityWithExtInfo getByUniqueAttributes(@PathParam("typeName") 
String typeName, @QueryParam("minExtInfo") @DefaultValue("false") boolean 
minExtInfo,
                                                         @Context 
HttpServletRequest servletRequest) throws AtlasBaseException {
         Servlets.validateQueryParamLength("typeName", typeName);
@@ -200,8 +195,6 @@ public class EntityREST {
 
      *******/
     @PUT
-    @Consumes(Servlets.JSON_MEDIA_TYPE)
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     @Path("/uniqueAttribute/type/{typeName}")
     public EntityMutationResponse 
partialUpdateEntityByUniqueAttrs(@PathParam("typeName") String typeName,
                                                                    @Context 
HttpServletRequest servletRequest,
@@ -245,8 +238,6 @@ public class EntityREST {
      * @return EntityMutationResponse
      */
     @DELETE
-    @Consumes(Servlets.JSON_MEDIA_TYPE)
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     @Path("/uniqueAttribute/type/{typeName}")
     public EntityMutationResponse 
deleteByUniqueAttribute(@PathParam("typeName") String typeName,
                                                           @Context 
HttpServletRequest servletRequest) throws AtlasBaseException {
@@ -277,8 +268,6 @@ public class EntityREST {
      * @throws AtlasBaseException
      */
     @POST
-    @Consumes(Servlets.JSON_MEDIA_TYPE)
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public EntityMutationResponse createOrUpdate(AtlasEntityWithExtInfo 
entity) throws AtlasBaseException {
         AtlasPerfTracer perf = null;
 
@@ -300,8 +289,6 @@ public class EntityREST {
      * Null updates are not possible
      *******/
     @PUT
-    @Consumes(Servlets.JSON_MEDIA_TYPE)
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     @Path("/guid/{guid}")
     public EntityMutationResponse 
partialUpdateEntityAttrByGuid(@PathParam("guid") String guid,
                                                                 
@QueryParam("name") String attrName,
@@ -329,8 +316,6 @@ public class EntityREST {
      */
     @DELETE
     @Path("/guid/{guid}")
-    @Consumes({Servlets.JSON_MEDIA_TYPE, MediaType.APPLICATION_JSON})
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public EntityMutationResponse deleteByGuid(@PathParam("guid") final String 
guid) throws AtlasBaseException {
         Servlets.validateQueryParamLength("guid", guid);
 
@@ -354,7 +339,6 @@ public class EntityREST {
      */
     @GET
     @Path("/guid/{guid}/classification/{classificationName}")
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasClassification getClassification(@PathParam("guid") String 
guid, @PathParam("classificationName") final String classificationName) throws 
AtlasBaseException {
         Servlets.validateQueryParamLength("guid", guid);
         Servlets.validateQueryParamLength("classificationName", 
classificationName);
@@ -384,7 +368,6 @@ public class EntityREST {
      */
     @GET
     @Path("/guid/{guid}/classifications")
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasClassification.AtlasClassifications 
getClassifications(@PathParam("guid") String guid) throws AtlasBaseException {
         Servlets.validateQueryParamLength("guid", guid);
 
@@ -411,8 +394,6 @@ public class EntityREST {
      */
     @POST
     @Path("/uniqueAttribute/type/{typeName}/classifications")
-    @Consumes({Servlets.JSON_MEDIA_TYPE, MediaType.APPLICATION_JSON})
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public void addClassificationsByUniqueAttribute(@PathParam("typeName") 
String typeName, @Context HttpServletRequest servletRequest, 
List<AtlasClassification> classifications) throws AtlasBaseException {
         Servlets.validateQueryParamLength("typeName", typeName);
 
@@ -443,8 +424,6 @@ public class EntityREST {
      */
     @POST
     @Path("/guid/{guid}/classifications")
-    @Consumes({Servlets.JSON_MEDIA_TYPE, MediaType.APPLICATION_JSON})
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public void addClassifications(@PathParam("guid") final String guid, 
List<AtlasClassification> classifications) throws AtlasBaseException {
         Servlets.validateQueryParamLength("guid", guid);
 
@@ -471,8 +450,6 @@ public class EntityREST {
      */
     @PUT
     @Path("/uniqueAttribute/type/{typeName}/classifications")
-    @Consumes({Servlets.JSON_MEDIA_TYPE, MediaType.APPLICATION_JSON})
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public void updateClassificationsByUniqueAttribute(@PathParam("typeName") 
String typeName, @Context HttpServletRequest servletRequest, 
List<AtlasClassification> classifications) throws AtlasBaseException {
         Servlets.validateQueryParamLength("typeName", typeName);
 
@@ -504,7 +481,6 @@ public class EntityREST {
      */
     @PUT
     @Path("/guid/{guid}/classifications")
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public void updateClassifications(@PathParam("guid") final String guid, 
List<AtlasClassification> classifications) throws AtlasBaseException {
         Servlets.validateQueryParamLength("guid", guid);
 
@@ -533,8 +509,6 @@ public class EntityREST {
      */
     @DELETE
     
@Path("/uniqueAttribute/type/{typeName}/classification/{classificationName}")
-    @Consumes({Servlets.JSON_MEDIA_TYPE, MediaType.APPLICATION_JSON})
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public void deleteClassificationByUniqueAttribute(@PathParam("typeName") 
String typeName, @Context HttpServletRequest 
servletRequest,@PathParam("classificationName") String classificationName) 
throws AtlasBaseException {
         Servlets.validateQueryParamLength("typeName", typeName);
         Servlets.validateQueryParamLength("classificationName", 
classificationName);
@@ -567,7 +541,6 @@ public class EntityREST {
      */
     @DELETE
     @Path("/guid/{guid}/classification/{classificationName}")
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public void deleteClassification(@PathParam("guid") String guid,
                                      @PathParam("classificationName") final 
String classificationName,
                                      @QueryParam("associatedEntityGuid") final 
String associatedEntityGuid) throws AtlasBaseException {
@@ -603,8 +576,6 @@ public class EntityREST {
      */
     @GET
     @Path("/bulk")
-    @Consumes(Servlets.JSON_MEDIA_TYPE)
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasEntitiesWithExtInfo getByGuids(@QueryParam("guid") 
List<String> guids, @QueryParam("minExtInfo") @DefaultValue("false") boolean 
minExtInfo) throws AtlasBaseException {
         if (CollectionUtils.isNotEmpty(guids)) {
             for (String guid : guids) {
@@ -635,8 +606,6 @@ public class EntityREST {
      */
     @POST
     @Path("/bulk")
-    @Consumes(Servlets.JSON_MEDIA_TYPE)
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public EntityMutationResponse createOrUpdate(AtlasEntitiesWithExtInfo 
entities) throws AtlasBaseException {
         AtlasPerfTracer perf = null;
 
@@ -659,8 +628,6 @@ public class EntityREST {
      */
     @DELETE
     @Path("/bulk")
-    @Consumes(Servlets.JSON_MEDIA_TYPE)
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public EntityMutationResponse deleteByGuids(@QueryParam("guid") final 
List<String> guids) throws AtlasBaseException {
         if (CollectionUtils.isNotEmpty(guids)) {
             for (String guid : guids) {
@@ -686,8 +653,6 @@ public class EntityREST {
      */
     @POST
     @Path("/bulk/classification")
-    @Consumes({Servlets.JSON_MEDIA_TYPE, MediaType.APPLICATION_JSON})
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public void addClassification(ClassificationAssociateRequest request) 
throws AtlasBaseException {
         AtlasPerfTracer perf = null;
 
@@ -715,8 +680,6 @@ public class EntityREST {
 
     @GET
     @Path("{guid}/audit")
-    @Consumes(Servlets.JSON_MEDIA_TYPE)
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public List<EntityAuditEventV2> getAuditEvents(@PathParam("guid") String 
guid, @QueryParam("startKey") String startKey,
                                                    @QueryParam("count") 
@DefaultValue("100") short count) throws AtlasBaseException {
         AtlasPerfTracer perf = null;

http://git-wip-us.apache.org/repos/asf/atlas/blob/6973830c/webapp/src/main/java/org/apache/atlas/web/rest/GlossaryREST.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/rest/GlossaryREST.java 
b/webapp/src/main/java/org/apache/atlas/web/rest/GlossaryREST.java
index 8ae8f99..d13fbd9 100644
--- a/webapp/src/main/java/org/apache/atlas/web/rest/GlossaryREST.java
+++ b/webapp/src/main/java/org/apache/atlas/web/rest/GlossaryREST.java
@@ -36,17 +36,16 @@ import org.springframework.stereotype.Service;
 
 import javax.inject.Inject;
 import javax.ws.rs.*;
+import javax.ws.rs.core.MediaType;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
 
-import static org.apache.atlas.web.util.Servlets.JSON_MEDIA_TYPE;
-
 @Path("v2/glossary")
 @Service
-@Consumes(JSON_MEDIA_TYPE)
-@Produces(JSON_MEDIA_TYPE)
+@Consumes({Servlets.JSON_MEDIA_TYPE, MediaType.APPLICATION_JSON})
+@Produces({Servlets.JSON_MEDIA_TYPE, MediaType.APPLICATION_JSON})
 public class GlossaryREST {
     private static final Logger LOG = 
LoggerFactory.getLogger(GlossaryREST.class);
     private static final Logger PERF_LOG = 
AtlasPerfTracer.getPerfLogger("rest.GlossaryREST");

http://git-wip-us.apache.org/repos/asf/atlas/blob/6973830c/webapp/src/main/java/org/apache/atlas/web/rest/LineageREST.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/rest/LineageREST.java 
b/webapp/src/main/java/org/apache/atlas/web/rest/LineageREST.java
index 8b0316b..4210077 100644
--- a/webapp/src/main/java/org/apache/atlas/web/rest/LineageREST.java
+++ b/webapp/src/main/java/org/apache/atlas/web/rest/LineageREST.java
@@ -25,7 +25,6 @@ import org.apache.atlas.model.lineage.AtlasLineageInfo;
 import org.apache.atlas.model.lineage.AtlasLineageInfo.LineageDirection;
 import org.apache.atlas.utils.AtlasPerfTracer;
 import org.apache.atlas.web.util.Servlets;
-import org.apache.commons.collections.CollectionUtils;
 import org.slf4j.Logger;
 import org.springframework.stereotype.Service;
 
@@ -40,6 +39,7 @@ import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
 
 /**
  * REST interface for an entity's lineage information
@@ -47,6 +47,8 @@ import javax.ws.rs.core.Context;
 @Path("v2/lineage")
 @Singleton
 @Service
+@Consumes({Servlets.JSON_MEDIA_TYPE, MediaType.APPLICATION_JSON})
+@Produces({Servlets.JSON_MEDIA_TYPE, MediaType.APPLICATION_JSON})
 public class LineageREST {
     private static final Logger PERF_LOG = 
AtlasPerfTracer.getPerfLogger("rest.LineageREST");
 
@@ -75,8 +77,6 @@ public class LineageREST {
      */
     @GET
     @Path("/{guid}")
-    @Consumes(Servlets.JSON_MEDIA_TYPE)
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasLineageInfo getLineageGraph(@PathParam("guid") String guid,
                                             @QueryParam("direction") 
@DefaultValue(DEFAULT_DIRECTION)  LineageDirection direction,
                                             @QueryParam("depth") 
@DefaultValue(DEFAULT_DEPTH) int depth) throws AtlasBaseException {

http://git-wip-us.apache.org/repos/asf/atlas/blob/6973830c/webapp/src/main/java/org/apache/atlas/web/rest/RelationshipREST.java
----------------------------------------------------------------------
diff --git 
a/webapp/src/main/java/org/apache/atlas/web/rest/RelationshipREST.java 
b/webapp/src/main/java/org/apache/atlas/web/rest/RelationshipREST.java
index 1014184..6d6432f 100644
--- a/webapp/src/main/java/org/apache/atlas/web/rest/RelationshipREST.java
+++ b/webapp/src/main/java/org/apache/atlas/web/rest/RelationshipREST.java
@@ -29,16 +29,8 @@ import org.springframework.stereotype.Service;
 
 import javax.inject.Inject;
 import javax.inject.Singleton;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
+import javax.ws.rs.*;
+import javax.ws.rs.core.MediaType;
 
 /**
  * REST interface for entity relationships.
@@ -46,6 +38,8 @@ import javax.ws.rs.QueryParam;
 @Path("v2/relationship")
 @Singleton
 @Service
+@Consumes({Servlets.JSON_MEDIA_TYPE, MediaType.APPLICATION_JSON})
+@Produces({Servlets.JSON_MEDIA_TYPE, MediaType.APPLICATION_JSON})
 public class RelationshipREST {
     private static final Logger PERF_LOG = 
AtlasPerfTracer.getPerfLogger("rest.RelationshipREST");
 
@@ -60,8 +54,6 @@ public class RelationshipREST {
      * Create a new relationship between entities.
      */
     @POST
-    @Consumes(Servlets.JSON_MEDIA_TYPE)
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasRelationship create(AtlasRelationship relationship) throws 
AtlasBaseException {
         AtlasPerfTracer perf = null;
 
@@ -81,8 +73,6 @@ public class RelationshipREST {
      * Update an existing relationship between entities.
      */
     @PUT
-    @Consumes(Servlets.JSON_MEDIA_TYPE)
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasRelationship update(AtlasRelationship relationship) throws 
AtlasBaseException {
         AtlasPerfTracer perf = null;
 
@@ -103,8 +93,6 @@ public class RelationshipREST {
      */
     @GET
     @Path("/guid/{guid}")
-    @Consumes(Servlets.JSON_MEDIA_TYPE)
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasRelationshipWithExtInfo getById(@PathParam("guid") String guid,
                                                 @QueryParam("extendedInfo") 
@DefaultValue("false") boolean extendedInfo)
                                                 throws AtlasBaseException {
@@ -136,8 +124,6 @@ public class RelationshipREST {
      */
     @DELETE
     @Path("/guid/{guid}")
-    @Consumes(Servlets.JSON_MEDIA_TYPE)
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public void deleteById(@PathParam("guid") String guid) throws 
AtlasBaseException {
         Servlets.validateQueryParamLength("guid", guid);
 

http://git-wip-us.apache.org/repos/asf/atlas/blob/6973830c/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 2091fdf..fb56fad 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
@@ -39,9 +39,16 @@ import org.springframework.stereotype.Service;
 import javax.inject.Inject;
 import javax.inject.Singleton;
 import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.*;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
 import javax.ws.rs.core.Context;
-import java.util.Collections;
+import javax.ws.rs.core.MediaType;
 import java.util.List;
 import java.util.Set;
 
@@ -51,6 +58,8 @@ import java.util.Set;
 @Path("v2/types")
 @Singleton
 @Service
+@Consumes({Servlets.JSON_MEDIA_TYPE, MediaType.APPLICATION_JSON})
+@Produces({Servlets.JSON_MEDIA_TYPE, MediaType.APPLICATION_JSON})
 public class TypesREST {
     private static final Logger PERF_LOG = 
AtlasPerfTracer.getPerfLogger("rest.TypesREST");
 
@@ -71,7 +80,6 @@ public class TypesREST {
      */
     @GET
     @Path("/typedef/name/{name}")
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasBaseTypeDef getTypeDefByName(@PathParam("name") String name) 
throws AtlasBaseException {
         Servlets.validateQueryParamLength("name", name);
 
@@ -89,7 +97,6 @@ public class TypesREST {
      */
     @GET
     @Path("/typedef/guid/{guid}")
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasBaseTypeDef getTypeDefByGuid(@PathParam("guid") String guid) 
throws AtlasBaseException {
         Servlets.validateQueryParamLength("guid", guid);
 
@@ -107,7 +114,6 @@ public class TypesREST {
      */
     @GET
     @Path("/typedefs/headers")
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public List<AtlasTypeDefHeader> getTypeDefHeaders(@Context 
HttpServletRequest httpServletRequest) throws AtlasBaseException {
         SearchFilter searchFilter = getSearchFilter(httpServletRequest);
 
@@ -124,7 +130,6 @@ public class TypesREST {
      */
     @GET
     @Path("/typedefs")
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasTypesDef getAllTypeDefs(@Context HttpServletRequest 
httpServletRequest) throws AtlasBaseException {
         SearchFilter searchFilter = getSearchFilter(httpServletRequest);
 
@@ -143,7 +148,6 @@ public class TypesREST {
      */
     @GET
     @Path("/enumdef/name/{name}")
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasEnumDef getEnumDefByName(@PathParam("name") String name) 
throws AtlasBaseException {
         Servlets.validateQueryParamLength("name", name);
 
@@ -162,7 +166,6 @@ public class TypesREST {
      */
     @GET
     @Path("/enumdef/guid/{guid}")
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasEnumDef getEnumDefByGuid(@PathParam("guid") String guid) 
throws AtlasBaseException {
         Servlets.validateQueryParamLength("guid", guid);
 
@@ -182,7 +185,6 @@ public class TypesREST {
      */
     @GET
     @Path("/structdef/name/{name}")
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasStructDef getStructDefByName(@PathParam("name") String name) 
throws AtlasBaseException {
         Servlets.validateQueryParamLength("name", name);
 
@@ -201,7 +203,6 @@ public class TypesREST {
      */
     @GET
     @Path("/structdef/guid/{guid}")
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasStructDef getStructDefByGuid(@PathParam("guid") String guid) 
throws AtlasBaseException {
         Servlets.validateQueryParamLength("guid", guid);
 
@@ -220,7 +221,6 @@ public class TypesREST {
      */
     @GET
     @Path("/classificationdef/name/{name}")
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasClassificationDef 
getClassificationDefByName(@PathParam("name") String name) throws 
AtlasBaseException {
         Servlets.validateQueryParamLength("name", name);
 
@@ -239,7 +239,6 @@ public class TypesREST {
      */
     @GET
     @Path("/classificationdef/guid/{guid}")
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasClassificationDef 
getClassificationDefByGuid(@PathParam("guid") String guid) throws 
AtlasBaseException {
         Servlets.validateQueryParamLength("guid", guid);
 
@@ -258,7 +257,6 @@ public class TypesREST {
      */
     @GET
     @Path("/entitydef/name/{name}")
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasEntityDef getEntityDefByName(@PathParam("name") String name) 
throws AtlasBaseException {
         Servlets.validateQueryParamLength("name", name);
 
@@ -277,7 +275,6 @@ public class TypesREST {
      */
     @GET
     @Path("/entitydef/guid/{guid}")
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasEntityDef getEntityDefByGuid(@PathParam("guid") String guid) 
throws AtlasBaseException {
         Servlets.validateQueryParamLength("guid", guid);
 
@@ -295,7 +292,6 @@ public class TypesREST {
      */
     @GET
     @Path("/relationshipdef/name/{name}")
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasRelationshipDef getRelationshipDefByName(@PathParam("name") 
String name) throws AtlasBaseException {
         Servlets.validateQueryParamLength("name", name);
 
@@ -314,7 +310,6 @@ public class TypesREST {
      */
     @GET
     @Path("/relationshipdef/guid/{guid}")
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasRelationshipDef getRelationshipDefByGuid(@PathParam("guid") 
String guid) throws AtlasBaseException {
         Servlets.validateQueryParamLength("guid", guid);
 
@@ -336,8 +331,6 @@ public class TypesREST {
      */
     @POST
     @Path("/typedefs")
-    @Consumes(Servlets.JSON_MEDIA_TYPE)
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public AtlasTypesDef createAtlasTypeDefs(final AtlasTypesDef typesDef) 
throws AtlasBaseException {
         AtlasPerfTracer perf = null;
 
@@ -363,8 +356,6 @@ public class TypesREST {
      */
     @PUT
     @Path("/typedefs")
-    @Consumes(Servlets.JSON_MEDIA_TYPE)
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     @Experimental
     public AtlasTypesDef updateAtlasTypeDefs(final AtlasTypesDef typesDef) 
throws AtlasBaseException {
         AtlasPerfTracer perf = null;
@@ -390,8 +381,6 @@ public class TypesREST {
      */
     @DELETE
     @Path("/typedefs")
-    @Consumes(Servlets.JSON_MEDIA_TYPE)
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     @Experimental
     public void deleteAtlasTypeDefs(final AtlasTypesDef typesDef) throws 
AtlasBaseException {
         AtlasPerfTracer perf = null;
@@ -419,8 +408,6 @@ public class TypesREST {
      */
     @DELETE
     @Path("/typedef/name/{typeName}")
-    @Consumes(Servlets.JSON_MEDIA_TYPE)
-    @Produces(Servlets.JSON_MEDIA_TYPE)
     public void deleteAtlasTypeByName(@PathParam("typeName") final String 
typeName) throws AtlasBaseException {
         AtlasPerfTracer perf = null;
 

Reply via email to