← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15289: Tracker, cleanup

 

------------------------------------------------------------
revno: 15289
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-05-16 15:32:48 +0200
message:
  Tracker, cleanup
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceService.java
  dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java
  dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.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-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceService.java	2014-05-08 17:33:45 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceService.java	2014-05-16 13:32:48 +0000
@@ -192,24 +192,6 @@
     TrackedEntityInstance getTrackedEntityInstance( String uid );
 
     /**
-     * Returns all {@link TrackedEntityInstance}
-     * 
-     * @return a collection of all TrackedEntityInstance, or an empty collection
-     *         if there are no TrackedEntityInstances.
-     */
-    //Collection<TrackedEntityInstance> getAllTrackedEntityInstances();
-
-    /**
-     * Retrieve entityInstances for mobile base on identifier value
-     * 
-     * @param searchText value
-     * @param orgUnitId
-     * 
-     * @return TrackedEntityInstance List
-     */
-    Collection<TrackedEntityInstance> getTrackedEntityInstancesForMobile( String searchText, int orgUnitId );
-
-    /**
      * Retrieve entityInstances base on organization unit with result limited
      * 
      * @param organisationUnit organisationUnit
@@ -222,24 +204,6 @@
         Integer max );
 
     /**
-     * Retrieve entityInstances who enrolled into a program with active status
-     * 
-     * @param program Program
-     * @return TrackedEntityInstance list
-     */
-    //Collection<TrackedEntityInstance> getTrackedEntityInstances( Program program );
-
-    /**
-     * Retrieve entityInstances registered in a orgunit and enrolled into a
-     * program with active status
-     * 
-     * @param organisationUnit
-     * @param program
-     * @return
-     */
-    //Collection<TrackedEntityInstance> getTrackedEntityInstances( OrganisationUnit organisationUnit, Program program );
-
-    /**
      * Search entityInstances base on OrganisationUnit and Program with result
      * limited name
      * 
@@ -253,15 +217,6 @@
         Integer min, Integer max );
 
     /**
-     * Sort the result by TrackedEntityInstanceAttribute
-     * 
-     * @param entityInstances
-     * @param attribute
-     * @return TrackedEntityInstance List
-     */
-    //Collection<TrackedEntityInstance> sortTrackedEntityInstancesByAttribute( Collection<TrackedEntityInstance> entityInstances, TrackedEntityAttribute attribute );
-
-    /**
      * Get entityInstances who has the same representative
      * 
      * @params entityInstance The representatives
@@ -299,27 +254,6 @@
         List<TrackedEntityAttributeValue> valuesForUpdate, Collection<TrackedEntityAttributeValue> valuesForDelete );
 
     /**
-     * Get the number of entityInstances who registered into an organisation
-     * unit
-     * 
-     * @param organisationUnit Organisation Unit
-     * 
-     * @return The number of entityInstances
-     */
-    //int countGetTrackedEntityInstancesByOrgUnit( OrganisationUnit organisationUnit );
-
-    /**
-     * Get the number of entityInstances who registered into an organisation
-     * unit and enrolled into a program
-     * 
-     * @param organisationUnit Organisation Unit
-     * @param program Program
-     * 
-     * @return The number of entityInstances
-     */
-    //int countGetTrackedEntityInstancesByOrgUnitProgram( OrganisationUnit organisationUnit, Program program );
-
-    /**
      * Cache value from String to the value type based on property
      * 
      * @param property Property name of entityInstance
@@ -331,17 +265,6 @@
     Object getObjectValue( String property, String value, I18nFormat format );
 
     /**
-     * Search entityInstances by phone number (performs partial search)
-     * 
-     * @param phoneNumber The string for searching by phone number
-     * @param min
-     * @param max
-     * 
-     * @return List of entityInstance
-     */
-    //Collection<TrackedEntityInstance> getTrackedEntityInstancesByPhone( String phoneNumber, Integer min, Integer max );
-
-    /**
      * Validate entityInstance attributes and validation criteria by program
      * before registering or updating information
      * 
@@ -369,30 +292,6 @@
     ValidationCriteria validateEnrollment( TrackedEntityInstance entityInstance, Program program, I18nFormat format );
 
     /**
-     * Retrieve entityInstances for mobile base on identifier value
-     * 
-     * @param searchText value
-     * @param orgUnitId
-     * @param attributeId
-     * @return TrackedEntityInstance List
-     */
-
-    Collection<TrackedEntityInstance> searchTrackedEntityInstancesForMobile( String searchText, int orgUnitId, int attributeId );
-
-    /**
-     * Search entityInstances by entityInstance attribute value (performs
-     * partial search)
-     * 
-     * @param entityInstance attribute value The string for searching by
-     *        entityInstance attribute value
-     * @param min
-     * @param max
-     * 
-     * @return List of TrackedEntityInstance
-     */
-    //Collection<TrackedEntityInstance> getTrackedEntityInstancesByAttributeValue( String searchText, int attributeId, Integer min, Integer max );
-
-    /**
      * Get entityInstances by {@link TrackedEntity}
      * 
      * @param trackedEntity {@link TrackedEntity}

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java	2014-05-14 14:05:57 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/hibernate/HibernateProgramStageInstanceStore.java	2014-05-16 13:32:48 +0000
@@ -293,29 +293,18 @@
         I18n i18n )
     {
         String sql = "SELECT ou.name as orgunit, ps.name as events, psi.completeduser as user_name, count(psi.programstageinstanceid) as number_of_events "
-            + "         FROM programstageinstance psi INNER JOIN programstage ps "
-            + "                         ON psi.programstageid = ps.programstageid "
-            + "                 INNER JOIN organisationunit ou "
-            + "                         ON ou.organisationunitid=psi.organisationunitid"
-            + "                 INNER JOIN program pg "
-            + "                         ON pg.programid = ps.programid "
-            + "         WHERE ou.organisationunitid in ( "
-            + TextUtils.getCommaDelimitedString( orgunitIds )
-            + " )                AND pg.programid = "
-            + program.getId()
-            + "         GROUP BY ou.name, ps.name, psi.completeduser, psi.completeddate, psi.completed "
-            + "         HAVING psi.completeddate >= '"
-            + startDate
-            + "'                AND psi.completeddate <= '"
-            + endDate
-            + "' "
-            + "                 AND psi.completed=true "
-            + "         ORDER BY ou.name, ps.name, psi.completeduser";
+            + "FROM programstageinstance psi INNER JOIN programstage ps "
+            + "ON psi.programstageid = ps.programstageid "
+            + "INNER JOIN organisationunit ou ON ou.organisationunitid=psi.organisationunitid "
+            + "INNER JOIN program pg ON pg.programid = ps.programid "
+            + "WHERE ou.organisationunitid in ( " + TextUtils.getCommaDelimitedString( orgunitIds ) + " ) "
+            + "AND pg.programid = " + program.getId()
+            + "GROUP BY ou.name, ps.name, psi.completeduser, psi.completeddate, psi.completed "
+            + "HAVING psi.completeddate >= '" + startDate + "' AND psi.completeddate <= '" + endDate + "' "
+            + "AND psi.completed=true ORDER BY ou.name, ps.name, psi.completeduser";
 
         SqlRowSet rs = jdbcTemplate.queryForRowSet( sql );
 
-        // Create column with Total column
-
         Grid grid = new ListGrid();
 
         grid.setTitle( program.getDisplayName() );

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java	2014-05-14 13:40:35 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java	2014-05-16 13:32:48 +0000
@@ -528,30 +528,6 @@
     }
 
     @Override
-    public Collection<TrackedEntityInstance> getTrackedEntityInstancesForMobile( String searchText, int orgUnitId )
-    {
-        Set<TrackedEntityInstance> entityInstances = new HashSet<TrackedEntityInstance>();
-        entityInstances.addAll( trackedEntityInstanceStore.getByPhoneNumber( searchText, 0, Integer.MAX_VALUE ) );
-
-        if ( orgUnitId != 0 )
-        {
-            Set<TrackedEntityInstance> toRemoveList = new HashSet<TrackedEntityInstance>();
-
-            for ( TrackedEntityInstance instance : entityInstances )
-            {
-                if ( instance.getOrganisationUnit().getId() != orgUnitId )
-                {
-                    toRemoveList.add( instance );
-                }
-            }
-
-            entityInstances.removeAll( toRemoveList );
-        }
-
-        return entityInstances;
-    }
-
-    @Override
     public Collection<TrackedEntityInstance> getTrackedEntityInstances( OrganisationUnit organisationUnit, Integer min,
         Integer max )
     {
@@ -676,33 +652,6 @@
     }
 
     @Override
-    public Collection<TrackedEntityInstance> searchTrackedEntityInstancesForMobile( String searchText, int orgUnitId,
-        int attributeId )
-    {
-        Set<TrackedEntityInstance> entityInstances = new HashSet<TrackedEntityInstance>();
-
-        entityInstances.addAll( trackedEntityInstanceStore.getByAttributeValue( searchText, attributeId, 0,
-            Integer.MAX_VALUE ) );
-
-        if ( orgUnitId != 0 )
-        {
-            Set<TrackedEntityInstance> toRemoveList = new HashSet<TrackedEntityInstance>();
-
-            for ( TrackedEntityInstance instance : entityInstances )
-            {
-
-                if ( instance.getOrganisationUnit().getId() != orgUnitId )
-                {
-                    toRemoveList.add( instance );
-                }
-            }
-            entityInstances.removeAll( toRemoveList );
-        }
-
-        return entityInstances;
-    }
-    
-    @Override
     public Collection<TrackedEntityInstance> getTrackedEntityInstances( TrackedEntity trackedEntity )
     {
         return trackedEntityInstanceStore.get( trackedEntity );