← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21433: remove all old custom filters for TEAController, should be handled by QueryService instead. The o...

 

------------------------------------------------------------
revno: 21433
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-12-14 09:29:24 +0100
message:
  remove all old custom filters for TEAController, should be handled by QueryService instead. The older queries can be replaced by using other endpoints.
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/TrackedEntityAttributeController.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/event/TrackedEntityAttributeController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/TrackedEntityAttributeController.java	2015-07-08 08:21:49 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/TrackedEntityAttributeController.java	2015-12-14 08:29:24 +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.program.Program;
-import org.hisp.dhis.program.ProgramService;
-import org.hisp.dhis.query.Order;
 import org.hisp.dhis.schema.descriptors.TrackedEntityAttributeSchemaDescriptor;
 import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
-import org.hisp.dhis.trackedentity.TrackedEntityAttributeService;
 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.List;
-
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */
@@ -54,53 +42,4 @@
 public class TrackedEntityAttributeController
     extends AbstractCrudController<TrackedEntityAttribute>
 {
-    @Autowired
-    private TrackedEntityAttributeService trackedEntityAttributeService;
-
-    @Autowired
-    private ProgramService programService;
-
-    @Override
-    protected List<TrackedEntityAttribute> getEntityList( WebMetaData metaData, WebOptions options, List<String> filters, List<Order> orders )
-    {
-        List<TrackedEntityAttribute> entityList = new ArrayList<>();
-
-        boolean withoutPrograms = options.getOptions().containsKey( "withoutPrograms" )
-            && Boolean.parseBoolean( options.getOptions().get( "withoutPrograms" ) );
-
-        if ( withoutPrograms )
-        {
-            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" );
-            Program program = programService.getProgram( programId );
-
-            if ( program != null )
-            {
-                entityList = new ArrayList<>( program.getTrackedEntityAttributes() );
-            }
-        }
-        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<>( trackedEntityAttributeService.getAllTrackedEntityAttributes() );
-        }
-
-        return entityList;
-    }
 }