=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AbstractCrudController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AbstractCrudController.java 2014-02-11 04:22:08 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AbstractCrudController.java 2014-02-11 04:27:09 +0000 @@ -84,18 +84,12 @@ // GET //-------------------------------------------------------------------------- - @RequestMapping(value = "/filtered", method = RequestMethod.GET) + @RequestMapping( value = "/filtered", method = RequestMethod.GET ) public void getJacksonClassMap( - @RequestParam(required = false) String include, - @RequestParam(required = false) String exclude, + @RequestParam( required = false ) String include, + @RequestParam( required = false ) String exclude, @RequestParam Map parameters, HttpServletResponse response ) throws IOException { - if ( include == null && exclude == null ) - { - // JacksonUtils.toJson( response.getOutputStream(), ReflectionUtils.getJacksonClassMap( getEntityClass() ) ); - // return; - } - WebOptions options = new WebOptions( parameters ); WebMetaData metaData = new WebMetaData(); List entityList = getEntityList( metaData, options ); @@ -118,7 +112,7 @@ JacksonUtils.toJson( response.getOutputStream(), output ); } - @RequestMapping(method = RequestMethod.GET) + @RequestMapping( method = RequestMethod.GET ) public String getObjectList( @RequestParam Map parameters, Model model, HttpServletRequest request ) throws Exception { WebOptions options = new WebOptions( parameters ); @@ -145,7 +139,7 @@ return StringUtils.uncapitalize( getEntitySimpleName() ) + "List"; } - @RequestMapping(value = "/query/{query}", method = RequestMethod.GET) + @RequestMapping( value = "/query/{query}", method = RequestMethod.GET ) public String query( @PathVariable String query, @RequestParam Map parameters, Model model, HttpServletRequest request ) throws Exception { WebOptions options = new WebOptions( parameters ); @@ -174,8 +168,8 @@ return StringUtils.uncapitalize( getEntitySimpleName() ) + "List"; } - @RequestMapping(value = "/{uid}", method = RequestMethod.GET) - public String getObject( @PathVariable("uid") String uid, @RequestParam Map parameters, + @RequestMapping( value = "/{uid}", method = RequestMethod.GET ) + public String getObject( @PathVariable( "uid" ) String uid, @RequestParam Map parameters, Model model, HttpServletRequest request, HttpServletResponse response ) throws Exception { WebOptions options = new WebOptions( parameters ); @@ -205,7 +199,7 @@ return StringUtils.uncapitalize( getEntitySimpleName() ); } - @RequestMapping(value = "/search/{query}", method = RequestMethod.GET) + @RequestMapping( value = "/search/{query}", method = RequestMethod.GET ) public String search( @PathVariable String query, @RequestParam Map parameters, Model model, HttpServletRequest request, HttpServletResponse response ) throws Exception { @@ -235,13 +229,13 @@ // POST //-------------------------------------------------------------------------- - @RequestMapping(method = RequestMethod.POST, consumes = { "application/xml", "text/xml" }) + @RequestMapping( method = RequestMethod.POST, consumes = { "application/xml", "text/xml" } ) public void postXmlObject( HttpServletResponse response, HttpServletRequest request, InputStream input ) throws Exception { throw new HttpRequestMethodNotSupportedException( RequestMethod.POST.toString() ); } - @RequestMapping(method = RequestMethod.POST, consumes = "application/json") + @RequestMapping( method = RequestMethod.POST, consumes = "application/json" ) public void postJsonObject( HttpServletResponse response, HttpServletRequest request, InputStream input ) throws Exception { throw new HttpRequestMethodNotSupportedException( RequestMethod.POST.toString() ); @@ -251,16 +245,16 @@ // PUT //-------------------------------------------------------------------------- - @RequestMapping(value = "/{uid}", method = RequestMethod.PUT, consumes = { "application/xml", "text/xml" }) - @ResponseStatus(value = HttpStatus.NO_CONTENT) - public void putXmlObject( HttpServletResponse response, HttpServletRequest request, @PathVariable("uid") String uid, InputStream input ) throws Exception + @RequestMapping( value = "/{uid}", method = RequestMethod.PUT, consumes = { "application/xml", "text/xml" } ) + @ResponseStatus( value = HttpStatus.NO_CONTENT ) + public void putXmlObject( HttpServletResponse response, HttpServletRequest request, @PathVariable( "uid" ) String uid, InputStream input ) throws Exception { throw new HttpRequestMethodNotSupportedException( RequestMethod.PUT.toString() ); } - @RequestMapping(value = "/{uid}", method = RequestMethod.PUT, consumes = "application/json") - @ResponseStatus(value = HttpStatus.NO_CONTENT) - public void putJsonObject( HttpServletResponse response, HttpServletRequest request, @PathVariable("uid") String uid, InputStream input ) throws Exception + @RequestMapping( value = "/{uid}", method = RequestMethod.PUT, consumes = "application/json" ) + @ResponseStatus( value = HttpStatus.NO_CONTENT ) + public void putJsonObject( HttpServletResponse response, HttpServletRequest request, @PathVariable( "uid" ) String uid, InputStream input ) throws Exception { throw new HttpRequestMethodNotSupportedException( RequestMethod.PUT.toString() ); } @@ -269,9 +263,9 @@ // DELETE //-------------------------------------------------------------------------- - @RequestMapping(value = "/{uid}", method = RequestMethod.DELETE) - @ResponseStatus(value = HttpStatus.NO_CONTENT) - public void deleteObject( HttpServletResponse response, HttpServletRequest request, @PathVariable("uid") String uid ) throws Exception + @RequestMapping( value = "/{uid}", method = RequestMethod.DELETE ) + @ResponseStatus( value = HttpStatus.NO_CONTENT ) + public void deleteObject( HttpServletResponse response, HttpServletRequest request, @PathVariable( "uid" ) String uid ) throws Exception { throw new HttpRequestMethodNotSupportedException( RequestMethod.DELETE.toString() ); } @@ -420,7 +414,7 @@ private String entitySimpleName; - @SuppressWarnings("unchecked") + @SuppressWarnings( "unchecked" ) protected Class getEntityClass() { if ( entityClass == null ) @@ -452,7 +446,7 @@ return entitySimpleName; } - @SuppressWarnings("unchecked") + @SuppressWarnings( "unchecked" ) protected T getEntityInstance() { try