=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Authorities.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Authorities.java 2014-03-26 11:12:59 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Authorities.java 2014-03-26 12:33:30 +0000 @@ -31,10 +31,15 @@ import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import org.hisp.dhis.common.DxfNamespaces; +import java.util.List; + /** * @author Morten Olav Hansen */ @JacksonXmlRootElement( localName = "authorities", namespace = DxfNamespaces.DXF_2_0 ) public class Authorities { + List publicCreate; + + List privateCreate; } === 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-03-25 15:43:26 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AbstractCrudController.java 2014-03-26 12:33:30 +0000 @@ -28,6 +28,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import com.google.common.collect.Lists; import com.google.common.collect.Maps; import org.hisp.dhis.api.controller.exception.NotFoundException; import org.hisp.dhis.api.utils.WebUtils; @@ -99,7 +100,7 @@ // GET //-------------------------------------------------------------------------- - @RequestMapping( method = RequestMethod.GET ) + @RequestMapping(method = RequestMethod.GET) public String getObjectList( @RequestParam Map parameters, Model model, HttpServletResponse response, HttpServletRequest request ) { @@ -128,11 +129,11 @@ return StringUtils.uncapitalize( getEntitySimpleName() ) + "List"; } - @RequestMapping( method = RequestMethod.GET, produces = { MediaType.APPLICATION_JSON_VALUE } ) + @RequestMapping(method = RequestMethod.GET, produces = { MediaType.APPLICATION_JSON_VALUE }) public void getObjectListJson( - @RequestParam( required = false ) String include, - @RequestParam( required = false ) String exclude, - @RequestParam( value = "filter", required = false ) List filters, + @RequestParam(required = false) String include, + @RequestParam(required = false) String exclude, + @RequestParam(value = "filter", required = false) List filters, @RequestParam Map parameters, Model model, HttpServletResponse response, HttpServletRequest request ) throws IOException { WebOptions options = new WebOptions( parameters ); @@ -214,8 +215,8 @@ } - @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 ); @@ -249,13 +250,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() ); @@ -264,17 +265,17 @@ // 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 + @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 + @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() ); @@ -284,9 +285,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 + @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() ); @@ -341,18 +342,22 @@ { List entityList; - if ( options.hasPaging() ) + if ( options.getOptions().containsKey( "query" ) ) + { + entityList = Lists.newArrayList( manager.filter( getEntityClass(), options.getOptions().get( "query" ) ) ); + } + else if ( options.hasPaging() ) { int count = manager.getCount( getEntityClass() ); Pager pager = new Pager( options.getPage(), count, options.getPageSize() ); metaData.setPager( pager ); - entityList = new ArrayList( manager.getBetween( getEntityClass(), pager.getOffset(), pager.getPageSize() ) ); + entityList = Lists.newArrayList( manager.getBetween( getEntityClass(), pager.getOffset(), pager.getPageSize() ) ); } else { - entityList = new ArrayList( manager.getAllSorted( getEntityClass() ) ); + entityList = Lists.newArrayList( manager.getAllSorted( getEntityClass() ) ); } return entityList; @@ -407,7 +412,7 @@ private String entitySimpleName; - @SuppressWarnings( "unchecked" ) + @SuppressWarnings("unchecked") protected Class getEntityClass() { if ( entityClass == null ) @@ -439,7 +444,7 @@ return entitySimpleName; } - @SuppressWarnings( "unchecked" ) + @SuppressWarnings("unchecked") protected T getEntityInstance() { try === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/InterpretationController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/InterpretationController.java 2014-03-18 08:10:10 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/InterpretationController.java 2014-03-26 12:33:30 +0000 @@ -28,6 +28,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import com.google.common.collect.Lists; import org.hisp.dhis.api.utils.ContextUtils; import org.hisp.dhis.chart.Chart; import org.hisp.dhis.chart.ChartService; @@ -99,11 +100,9 @@ { List entityList; - Date lastUpdated = options.getLastUpdated(); - - if ( lastUpdated != null ) + if ( options.getOptions().containsKey( "query" ) ) { - entityList = new ArrayList( interpretationService.getInterpretations( lastUpdated ) ); + entityList = Lists.newArrayList( manager.filter( getEntityClass(), options.getOptions().get( "query" ) ) ); } else if ( options.hasPaging() ) { === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MessageConversationController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MessageConversationController.java 2014-03-18 08:10:10 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/MessageConversationController.java 2014-03-26 12:33:30 +0000 @@ -37,6 +37,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import com.google.common.collect.Lists; import org.hisp.dhis.api.utils.ContextUtils; import org.hisp.dhis.common.Pager; import org.hisp.dhis.dxf2.message.Message; @@ -100,11 +101,9 @@ { List entityList; - Date lastUpdated = options.getLastUpdated(); - - if ( lastUpdated != null ) + if ( options.getOptions().containsKey( "query" ) ) { - entityList = new ArrayList( manager.getByLastUpdated( getEntityClass(), lastUpdated ) ); + entityList = Lists.newArrayList( manager.filter( getEntityClass(), options.getOptions().get( "query" ) ) ); } else if ( options.hasPaging() ) { === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/DataElementController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/DataElementController.java 2014-03-18 08:10:10 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/DataElementController.java 2014-03-26 12:33:30 +0000 @@ -28,6 +28,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import com.google.common.collect.Lists; import org.hisp.dhis.api.controller.AbstractCrudController; import org.hisp.dhis.api.controller.WebMetaData; import org.hisp.dhis.api.controller.WebOptions; @@ -61,11 +62,13 @@ { List entityList; - Date lastUpdated = options.getLastUpdated(); - String KEY_DOMAIN_TYPE = "domainType"; - if ( DataElement.DOMAIN_TYPE_AGGREGATE.equals( options.getOptions().get( KEY_DOMAIN_TYPE ) ) + if ( options.getOptions().containsKey( "query" ) ) + { + entityList = Lists.newArrayList( manager.filter( getEntityClass(), options.getOptions().get( "query" ) ) ); + } + else if ( DataElement.DOMAIN_TYPE_AGGREGATE.equals( options.getOptions().get( KEY_DOMAIN_TYPE ) ) || DataElement.DOMAIN_TYPE_PATIENT.equals( options.getOptions().get( KEY_DOMAIN_TYPE ) ) ) { String domainType = options.getOptions().get( KEY_DOMAIN_TYPE ); @@ -85,10 +88,6 @@ Collections.sort( entityList, IdentifiableObjectNameComparator.INSTANCE ); } } - else if ( lastUpdated != null ) - { - entityList = new ArrayList( manager.getByLastUpdatedSorted( getEntityClass(), lastUpdated ) ); - } else if ( options.hasPaging() ) { int count = manager.getCount( getEntityClass() ); === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/DataElementOperandController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/DataElementOperandController.java 2014-03-18 08:10:10 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/DataElementOperandController.java 2014-03-26 12:33:30 +0000 @@ -72,7 +72,11 @@ { List entityList; - if ( options.getOptions().containsKey( "dataElementGroup" ) ) + if ( options.getOptions().containsKey( "query" ) ) + { + entityList = Lists.newArrayList( manager.filter( getEntityClass(), options.getOptions().get( "query" ) ) ); + } + else if ( options.getOptions().containsKey( "dataElementGroup" ) ) { DataElementGroup dataElementGroup = manager.get( DataElementGroup.class, options.getOptions().get( "dataElementGroup" ) ); === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/GeneratedDataElementOperandController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/GeneratedDataElementOperandController.java 2014-03-25 10:14:39 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/GeneratedDataElementOperandController.java 2014-03-26 12:33:30 +0000 @@ -28,6 +28,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import com.google.common.collect.Lists; import org.hisp.dhis.api.controller.AbstractCrudController; import org.hisp.dhis.api.controller.WebMetaData; import org.hisp.dhis.api.controller.WebOptions; === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/ProgramController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/ProgramController.java 2014-03-18 08:10:10 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/ProgramController.java 2014-03-26 12:33:30 +0000 @@ -28,6 +28,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import com.google.common.collect.Lists; import org.hisp.dhis.api.controller.AbstractCrudController; import org.hisp.dhis.api.controller.WebMetaData; import org.hisp.dhis.api.controller.WebOptions; @@ -56,11 +57,9 @@ { List entityList; - Date lastUpdated = options.getLastUpdated(); - - if ( lastUpdated != null ) + if ( options.getOptions().containsKey( "query" ) ) { - entityList = new ArrayList( manager.getByLastUpdatedSorted( getEntityClass(), lastUpdated ) ); + entityList = Lists.newArrayList( manager.filter( getEntityClass(), options.getOptions().get( "query" ) ) ); } else if ( options.hasPaging() ) { === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/ProgramStageController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/ProgramStageController.java 2014-03-18 08:10:10 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/ProgramStageController.java 2014-03-26 12:33:30 +0000 @@ -28,6 +28,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import com.google.common.collect.Lists; import org.hisp.dhis.api.controller.AbstractCrudController; import org.hisp.dhis.api.controller.WebMetaData; import org.hisp.dhis.api.controller.WebOptions; @@ -40,7 +41,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import java.util.ArrayList; -import java.util.Date; import java.util.List; /** @@ -66,11 +66,9 @@ { List entityList = new ArrayList(); - Date lastUpdated = options.getLastUpdated(); - - if ( lastUpdated != null ) + if ( options.getOptions().containsKey( "query" ) ) { - entityList = new ArrayList( manager.getByLastUpdatedSorted( getEntityClass(), lastUpdated ) ); + entityList = Lists.newArrayList( manager.filter( getEntityClass(), options.getOptions().get( "query" ) ) ); } else if ( options.hasPaging() ) { === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/TrackedEntityAttributeController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/TrackedEntityAttributeController.java 2014-03-18 14:54:13 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/event/TrackedEntityAttributeController.java 2014-03-26 12:33:30 +0000 @@ -28,6 +28,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import com.google.common.collect.Lists; import org.hisp.dhis.api.controller.AbstractCrudController; import org.hisp.dhis.api.controller.WebMetaData; import org.hisp.dhis.api.controller.WebOptions; @@ -81,7 +82,10 @@ entityList = new ArrayList( trackedEntityAttributeService.getTrackedEntityAttributesWithoutProgram() ); } - + else if ( options.getOptions().containsKey( "query" ) ) + { + entityList = Lists.newArrayList( manager.filter( getEntityClass(), options.getOptions().get( "query" ) ) ); + } else if ( options.getOptions().containsKey( "program" ) ) { String programId = options.getOptions().get( "program" ); @@ -92,7 +96,6 @@ entityList = new ArrayList( program.getTrackedEntityAttributes() ); } } - else if ( options.hasPaging() ) { int count = manager.getCount( getEntityClass() ); === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapViewController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapViewController.java 2014-03-18 08:10:10 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/mapping/MapViewController.java 2014-03-26 12:33:30 +0000 @@ -28,6 +28,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import com.google.common.collect.Lists; import org.hisp.dhis.api.controller.AbstractCrudController; import org.hisp.dhis.api.controller.WebMetaData; import org.hisp.dhis.api.controller.WebOptions; @@ -122,11 +123,9 @@ { List entityList; - Date lastUpdated = options.getLastUpdated(); - - if ( lastUpdated != null ) + if ( options.getOptions().containsKey( "query" ) ) { - entityList = new ArrayList( manager.getByLastUpdatedSorted( getEntityClass(), lastUpdated ) ); + entityList = Lists.newArrayList( manager.filter( getEntityClass(), options.getOptions().get( "query" ) ) ); } else { === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/organisationunit/OrganisationUnitController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/organisationunit/OrganisationUnitController.java 2014-03-24 09:51:04 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/organisationunit/OrganisationUnitController.java 2014-03-26 12:33:30 +0000 @@ -28,16 +28,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - import org.hisp.dhis.api.controller.AbstractCrudController; import org.hisp.dhis.api.controller.WebMetaData; import org.hisp.dhis.api.controller.WebOptions; @@ -64,6 +54,14 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Set; + /** * @author Morten Olav Hansen */ @@ -85,8 +83,6 @@ { List entityList; - Date lastUpdated = options.getLastUpdated(); - boolean levelSorted = options.getOptions().containsKey( "levelSorted" ) && Boolean.parseBoolean( options.getOptions().get( "levelSorted" ) ); Integer level = null; @@ -124,7 +120,7 @@ else if ( "true".equals( options.getOptions().get( "userDataViewFallback" ) ) ) { User user = currentUserService.getCurrentUser(); - + if ( user != null && user.hasDataViewOrganisationUnit() ) { entityList = new ArrayList( user.getDataViewOrganisationUnits() ); @@ -134,9 +130,9 @@ entityList = new ArrayList( organisationUnitService.getOrganisationUnitsAtLevel( 1 ) ); } } - else if ( lastUpdated != null ) + else if ( options.getOptions().containsKey( "query" ) ) { - entityList = new ArrayList( manager.getByLastUpdatedSorted( getEntityClass(), lastUpdated ) ); + entityList = new ArrayList( manager.filter( getEntityClass(), options.getOptions().get( "query" ) ) ); if ( levelSorted ) { @@ -184,8 +180,8 @@ } @Override - @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 ); @@ -272,19 +268,19 @@ return StringUtils.uncapitalize( getEntitySimpleName() ); } - + @RequestMapping(value = "/withinRange", method = RequestMethod.GET, produces = { "*/*", "application/json" }) - public void getEntitiesWithinRange( @RequestParam Double longitude, @RequestParam Double latitude, + public void getEntitiesWithinRange( @RequestParam Double longitude, @RequestParam Double latitude, @RequestParam Double distance, @RequestParam(required = false) String orgUnitGroupSetId, Model model, HttpServletRequest request, HttpServletResponse response ) throws Exception { List entityList = new ArrayList( organisationUnitService.getWithinCoordinateArea( longitude, latitude, distance ) ); - + for ( OrganisationUnit orgunit : entityList ) { Set attributeValues = orgunit.getAttributeValues(); attributeValues.clear(); - + if ( orgUnitGroupSetId != null ) // Add org unit group symbol into attr { for ( OrganisationUnitGroup orgunitGroup : orgunit.getGroups() ) @@ -292,21 +288,21 @@ if ( orgunitGroup.getGroupSet() != null ) { OrganisationUnitGroupSet orgunitGroupSet = orgunitGroup.getGroupSet(); - + if ( orgunitGroupSet.getUid().compareTo( orgUnitGroupSetId ) == 0 ) - { + { AttributeValue attributeValue = new AttributeValue(); attributeValue.setAttribute( new Attribute( "OrgUnitGroupSymbol", "OrgUnitGroupSymbol" ) ); attributeValue.setValue( orgunitGroup.getSymbol() ); - + attributeValues.add( attributeValue ); } } } } - + orgunit.setAttributeValues( attributeValues ); - + // Clear out all data not needed for this task orgunit.removeAllDataSets(); orgunit.removeAllUsers(); === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/UserController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/UserController.java 2014-03-26 09:26:06 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/UserController.java 2014-03-26 12:33:30 +0000 @@ -28,14 +28,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - +import com.google.common.collect.Lists; import org.hisp.dhis.api.controller.AbstractCrudController; import org.hisp.dhis.api.controller.WebMetaData; import org.hisp.dhis.api.controller.WebOptions; @@ -50,11 +43,17 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + /** * @author Morten Olav Hansen */ @Controller -@RequestMapping(value = UserController.RESOURCE_PATH) +@RequestMapping( value = UserController.RESOURCE_PATH ) public class UserController extends AbstractCrudController { @@ -71,8 +70,8 @@ } @Override - @PreAuthorize("hasRole('ALL') or hasRole('F_USER_VIEW')") - public String getObject( @PathVariable("uid") String uid, @RequestParam Map parameters, Model model, + @PreAuthorize( "hasRole('ALL') or hasRole('F_USER_VIEW')" ) + public String getObject( @PathVariable( "uid" ) String uid, @RequestParam Map parameters, Model model, HttpServletRequest request, HttpServletResponse response ) throws Exception { return super.getObject( uid, parameters, model, request, response ); @@ -83,11 +82,9 @@ { List entityList; - Date lastUpdated = options.getLastUpdated(); - - if ( lastUpdated != null ) + if ( options.getOptions().containsKey( "query" ) ) { - entityList = new ArrayList( userService.getUsersByLastUpdated( lastUpdated ) ); + entityList = Lists.newArrayList( manager.filter( getEntityClass(), options.getOptions().get( "query" ) ) ); } else if ( options.hasPaging() ) {