=== 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 2013-03-14 08:04:13 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AbstractCrudController.java 2013-03-14 11:28:38 +0000 @@ -36,11 +36,14 @@ import org.hisp.dhis.system.util.ReflectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; -import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.ui.Model; import org.springframework.util.StringUtils; import org.springframework.web.HttpRequestMethodNotSupportedException; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseStatus; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -68,7 +71,7 @@ // GET //-------------------------------------------------------------------------- - @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 ); @@ -91,7 +94,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 ); @@ -114,8 +117,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 ); @@ -141,7 +144,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 { @@ -172,13 +175,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() ); @@ -188,16 +191,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() ); } @@ -206,9 +209,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() ); } @@ -319,7 +322,7 @@ private String entitySimpleName; - @SuppressWarnings( "unchecked" ) + @SuppressWarnings("unchecked") protected Class getEntityClass() { if ( entityClass == null ) @@ -351,7 +354,7 @@ return entitySimpleName; } - @SuppressWarnings( "unchecked" ) + @SuppressWarnings("unchecked") protected T getEntityInstance() { try