dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #33079
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16844: when doing :like optimization in ACC, check for paging
------------------------------------------------------------
revno: 16844
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-09-29 11:34:06 +0700
message:
when doing :like optimization in ACC, check for paging
modified:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AbstractCrudController.java
dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/addValidationRuleGroupForm.vm
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AbstractCrudController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AbstractCrudController.java 2014-09-12 09:14:40 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AbstractCrudController.java 2014-09-29 04:34:06 +0000
@@ -127,7 +127,7 @@
// GET
//--------------------------------------------------------------------------
- @RequestMapping( method = RequestMethod.GET )
+ @RequestMapping(method = RequestMethod.GET)
public @ResponseBody RootNode getObjectList(
@RequestParam Map<String, String> parameters, HttpServletResponse response, HttpServletRequest request )
{
@@ -169,12 +169,19 @@
if ( name != null )
{
- int count = manager.getCountLikeName( getEntityClass(), name );
-
- Pager pager = new Pager( options.getPage(), count, options.getPageSize() );
- metaData.setPager( pager );
-
- entityList = Lists.newArrayList( manager.getBetweenLikeName( getEntityClass(), name, pager.getOffset(), pager.getPageSize() ) );
+ if ( options.hasPaging() )
+ {
+ int count = manager.getCountLikeName( getEntityClass(), name );
+
+ Pager pager = new Pager( options.getPage(), count, options.getPageSize() );
+ metaData.setPager( pager );
+
+ entityList = Lists.newArrayList( manager.getBetweenLikeName( getEntityClass(), name, pager.getOffset(), pager.getPageSize() ) );
+ }
+ else
+ {
+ entityList = Lists.newArrayList( manager.getLikeName( getEntityClass(), name ) );
+ }
}
else
{
@@ -321,7 +328,7 @@
// 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
{
if ( !aclService.canCreate( currentUserService.getCurrentUser(), getEntityClass() ) )
@@ -346,7 +353,7 @@
renderService.toXml( response.getOutputStream(), summary );
}
- @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
{
if ( !aclService.canCreate( currentUserService.getCurrentUser(), getEntityClass() ) )
@@ -375,9 +382,9 @@
// PUT
//--------------------------------------------------------------------------
- @RequestMapping( value = "/{uid}", method = RequestMethod.PUT, consumes = { MediaType.APPLICATION_XML_VALUE, MediaType.TEXT_XML_VALUE } )
- @ResponseStatus( value = HttpStatus.NO_CONTENT )
- public void putXmlObject( HttpServletResponse response, HttpServletRequest request, @PathVariable( "uid" ) String uid, InputStream
+ @RequestMapping(value = "/{uid}", method = RequestMethod.PUT, consumes = { MediaType.APPLICATION_XML_VALUE, MediaType.TEXT_XML_VALUE })
+ @ResponseStatus(value = HttpStatus.NO_CONTENT)
+ public void putXmlObject( HttpServletResponse response, HttpServletRequest request, @PathVariable("uid") String uid, InputStream
input ) throws Exception
{
List<T> objects = getEntity( uid );
@@ -406,9 +413,9 @@
renderService.toXml( response.getOutputStream(), summary );
}
- @RequestMapping( value = "/{uid}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE )
- @ResponseStatus( value = HttpStatus.NO_CONTENT )
- public void putJsonObject( HttpServletResponse response, HttpServletRequest request, @PathVariable( "uid" ) String uid, InputStream
+ @RequestMapping(value = "/{uid}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
+ @ResponseStatus(value = HttpStatus.NO_CONTENT)
+ public void putJsonObject( HttpServletResponse response, HttpServletRequest request, @PathVariable("uid") String uid, InputStream
input ) throws Exception
{
List<T> objects = getEntity( uid );
@@ -441,9 +448,9 @@
// DELETE
//--------------------------------------------------------------------------
- @RequestMapping( value = "/{uid}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE )
- @ResponseStatus( value = HttpStatus.NO_CONTENT )
- public void deleteObject( HttpServletResponse response, HttpServletRequest request, @PathVariable( "uid" ) String uid )
+ @RequestMapping(value = "/{uid}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
+ @ResponseStatus(value = HttpStatus.NO_CONTENT)
+ public void deleteObject( HttpServletResponse response, HttpServletRequest request, @PathVariable("uid") String uid )
throws Exception
{
List<T> objects = getEntity( uid );
@@ -595,7 +602,7 @@
private String entitySimpleName;
- @SuppressWarnings( "unchecked" )
+ @SuppressWarnings("unchecked")
protected Class<T> getEntityClass()
{
if ( entityClass == null )
@@ -627,7 +634,7 @@
return entitySimpleName;
}
- @SuppressWarnings( "unchecked" )
+ @SuppressWarnings("unchecked")
protected T getEntityInstance()
{
try
=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/addValidationRuleGroupForm.vm'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/addValidationRuleGroupForm.vm 2014-07-26 19:08:32 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/addValidationRuleGroupForm.vm 2014-09-29 04:34:06 +0000
@@ -12,6 +12,7 @@
return option;
}
});
+
jQuery("#availableUserGroupsToAlert").dhisAjaxSelect({
source: "../dhis-web-commons-ajax-json/getUserGroups.action",
iterator: "userGroups",