dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #42315
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21636: clear out custom getEntityList in data element controller, filtering by domain type can be replac...
------------------------------------------------------------
revno: 21636
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2016-01-07 16:09:17 +0700
message:
clear out custom getEntityList in data element controller, filtering by domain type can be replaced with filter=domainType:eq:TYPE
modified:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/dataelement/DataElementController.java
--
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/dataelement/DataElementController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/dataelement/DataElementController.java 2016-01-04 02:27:49 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/dataelement/DataElementController.java 2016-01-07 09:09:17 +0000
@@ -28,24 +28,12 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import com.google.common.collect.Lists;
-import org.hisp.dhis.common.Pager;
-import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementDomain;
-import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.schema.descriptors.DataElementSchemaDescriptor;
import org.hisp.dhis.webapi.controller.AbstractCrudController;
-import org.hisp.dhis.webapi.webdomain.WebMetaData;
-import org.hisp.dhis.webapi.webdomain.WebOptions;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
@@ -54,53 +42,4 @@
public class DataElementController
extends AbstractCrudController<DataElement>
{
- @Autowired
- private DataElementService dataElementService;
-
- protected List<DataElement> getEntityList( WebMetaData metaData, WebOptions options )
- {
- List<DataElement> entityList;
-
- String keyDomainType = "domainType";
-
- if ( options.getOptions().containsKey( "query" ) )
- {
- entityList = Lists.newArrayList( manager.filter( getEntityClass(), options.getOptions().get( "query" ) ) );
- }
- else if ( DataElementDomain.AGGREGATE.equals( options.getOptions().get( keyDomainType ) )
- || DataElementDomain.TRACKER.equals( options.getOptions().get( keyDomainType ) ) )
- {
- String domainType = options.getOptions().get( keyDomainType );
-
- if ( options.hasPaging() )
- {
- int count = dataElementService.getDataElementCountByDomainType( DataElementDomain.fromValue( domainType ) );
-
- Pager pager = new Pager( options.getPage(), count, options.getPageSize() );
- metaData.setPager( pager );
-
- entityList = new ArrayList<>( dataElementService.getDataElementsByDomainType( DataElementDomain.fromValue( domainType ), pager.getOffset(), pager.getPageSize() ) );
- }
- else
- {
- entityList = new ArrayList<>( dataElementService.getDataElementsByDomainType( DataElementDomain.fromValue( domainType ) ) );
- Collections.sort( entityList, IdentifiableObjectNameComparator.INSTANCE );
- }
- }
- 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.getBetweenSorted( getEntityClass(), pager.getOffset(), pager.getPageSize() ) );
- }
- else
- {
- entityList = new ArrayList<>( manager.getAllSorted( getEntityClass() ) );
- }
-
- return entityList;
- }
}