← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15212: Tracker, removed unused method, cleanup

 

Merge authors:
  Lars Helge Øverland (larshelge)
------------------------------------------------------------
revno: 15212 [merge]
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2014-05-10 14:06:43 +0200
message:
  Tracker, removed unused method, cleanup
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java
  dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java
  dhis-2/dhis-services/dhis-service-tracker/src/main/resources/META-INF/dhis/beans.xml


--
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/program/ProgramStageInstanceService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java	2014-05-09 15:56:43 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java	2014-05-10 11:40:24 +0000
@@ -146,17 +146,6 @@
     List<ProgramStageInstance> getProgramStageInstances( TrackedEntityInstance entityInstance, Boolean completed );
 
     /**
-     * Get an event report of program instance
-     * 
-     * @param programInstance ProgramInstance
-     * @param format I18nFormat object
-     * @param i18n I18n object
-     * 
-     * @return List of grids. Each grid is included all information of a event
-     */
-    List<Grid> getProgramStageInstancesReport( ProgramInstance programInstance, I18nFormat format, I18n i18n );
-
-    /**
      * Create relationship between an OutboundSms with many events.
      * 
      * @param programStageInstances Event list

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java	2014-05-09 15:56:43 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java	2014-05-10 12:06:43 +0000
@@ -40,7 +40,6 @@
 
 import org.hisp.dhis.common.Grid;
 import org.hisp.dhis.common.GridHeader;
-import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.message.MessageConversation;
@@ -54,8 +53,6 @@
 import org.hisp.dhis.trackedentity.TrackedEntityInstance;
 import org.hisp.dhis.trackedentity.TrackedEntityInstanceReminder;
 import org.hisp.dhis.trackedentity.TrackedEntityInstanceReminderService;
-import org.hisp.dhis.trackedentitydatavalue.TrackedEntityDataValue;
-import org.hisp.dhis.trackedentitydatavalue.TrackedEntityDataValueService;
 import org.hisp.dhis.user.CurrentUserService;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -84,13 +81,6 @@
         this.programInstanceService = programInstanceService;
     }
 
-    private TrackedEntityDataValueService dataValueService;
-
-    public void setDataValueService( TrackedEntityDataValueService dataValueService )
-    {
-        this.dataValueService = dataValueService;
-    }
-
     private SmsSender smsSender;
 
     public void setSmsSender( SmsSender smsSender )
@@ -195,76 +185,6 @@
     }
 
     @Override
-    public List<Grid> getProgramStageInstancesReport( ProgramInstance programInstance, I18nFormat format, I18n i18n )
-    {
-        List<Grid> grids = new ArrayList<Grid>();
-
-        Collection<ProgramStageInstance> programStageInstances = programInstance.getProgramStageInstances();
-
-        for ( ProgramStageInstance programStageInstance : programStageInstances )
-        {
-            Grid grid = new ListGrid();
-
-            // -----------------------------------------------------------------
-            // Title
-            // -----------------------------------------------------------------
-
-            Date executionDate = programStageInstance.getExecutionDate();
-            String executionDateValue = (executionDate != null) ? format.formatDate( programStageInstance
-                .getExecutionDate() ) : "[" + i18n.getString( "none" ) + "]";
-
-            grid.setTitle( programStageInstance.getProgramStage().getName() );
-            grid.setSubtitle( i18n.getString( "due_date" ) + ": "
-                + format.formatDate( programStageInstance.getDueDate() ) + " - " + i18n.getString( "report_date" )
-                + ": " + executionDateValue );
-
-            // -----------------------------------------------------------------
-            // Headers
-            // -----------------------------------------------------------------
-
-            grid.addHeader( new GridHeader( i18n.getString( "name" ), false, true ) );
-            grid.addHeader( new GridHeader( i18n.getString( "value" ), false, true ) );
-
-            // -----------------------------------------------------------------
-            // Values
-            // -----------------------------------------------------------------
-
-            Collection<TrackedEntityDataValue> entityDataValues = dataValueService
-                .getTrackedEntityDataValues( programStageInstance );
-
-            if ( executionDate == null || entityDataValues == null || entityDataValues.size() == 0 )
-            {
-                grid.addRow();
-                grid.addValue( "[" + i18n.getString( "none" ) + "]" );
-                grid.addValue( "" );
-            }
-            else
-            {
-                for ( TrackedEntityDataValue entityDataValue : entityDataValues )
-                {
-                    DataElement dataElement = entityDataValue.getDataElement();
-
-                    grid.addRow();
-                    grid.addValue( dataElement.getName() );
-
-                    if ( dataElement.getType().equals( DataElement.VALUE_TYPE_BOOL ) )
-                    {
-                        grid.addValue( i18n.getString( entityDataValue.getValue() ) );
-                    }
-                    else
-                    {
-                        grid.addValue( entityDataValue.getValue() );
-                    }
-                }
-            }
-
-            grids.add( grid );
-        }
-
-        return grids;
-    }
-
-    @Override
     public void updateProgramStageInstances( Collection<Integer> programStageInstanceIds, OutboundSms outboundSms )
     {
         programStageInstanceStore.update( programStageInstanceIds, outboundSms );
@@ -306,13 +226,7 @@
         int total = programInstanceService.countProgramInstances( program, orgunitIds, startDate, endDate );
         grid.addRow();
         grid.addValue( i18n.getString( "total_new_enrollments_in_this_period" ) );
-        grid.addValue( total );
-        grid.addValue( "" );
-        grid.addValue( "" );
-        grid.addValue( "" );
-        grid.addValue( "" );
-        grid.addValue( "" );
-        grid.addValue( "" );
+        grid.addValue( total ).addEmptyValues( 6 );
 
         // Total programs completed in this period
 
@@ -320,13 +234,7 @@
             program, orgunitIds, startDate, endDate );
         grid.addRow();
         grid.addValue( i18n.getString( "total_programs_completed_in_this_period" ) );
-        grid.addValue( totalCompleted );
-        grid.addValue( "" );
-        grid.addValue( "" );
-        grid.addValue( "" );
-        grid.addValue( "" );
-        grid.addValue( "" );
-        grid.addValue( "" );
+        grid.addValue( totalCompleted ).addEmptyValues( 6 );
 
         // Total programs discontinued (un-enrollments)
 
@@ -334,13 +242,7 @@
             program, orgunitIds, startDate, endDate );
         grid.addRow();
         grid.addValue( i18n.getString( "total_programs_discontinued_unenrollments" ) );
-        grid.addValue( totalDiscontinued );
-        grid.addValue( "" );
-        grid.addValue( "" );
-        grid.addValue( "" );
-        grid.addValue( "" );
-        grid.addValue( "" );
-        grid.addValue( "" );
+        grid.addValue( totalDiscontinued ).addEmptyValues( 6 );
 
         // Average number of stages for complete programs
 
@@ -353,37 +255,16 @@
                 ProgramInstance.STATUS_ACTIVE );
             percent = (stageCompleted + 0.0) / totalCompleted;
         }
-        grid.addValue( format.formatValue( percent ) );
-        grid.addValue( "" );
-        grid.addValue( "" );
-        grid.addValue( "" );
-        grid.addValue( "" );
-        grid.addValue( "" );
-        grid.addValue( "" );
+        grid.addValue( format.formatValue( percent ) ).addEmptyValues( 6 );
 
         // Add empty row
 
-        grid.addRow();
-        grid.addValue( "" );
-        grid.addValue( "" );
-        grid.addValue( "" );
-        grid.addValue( "" );
-        grid.addValue( "" );
-        grid.addValue( "" );
-        grid.addValue( "" );
-        grid.addValue( "" );
+        grid.addRow().addEmptyValues( 8 );
 
         // Summary by stage
 
         grid.addRow();
-        grid.addValue( i18n.getString( "summary_by_stage" ) );
-        grid.addValue( "" );
-        grid.addValue( "" );
-        grid.addValue( "" );
-        grid.addValue( "" );
-        grid.addValue( "" );
-        grid.addValue( "" );
-        grid.addValue( "" );
+        grid.addValue( i18n.getString( "summary_by_stage" ) ).addEmptyValues( 7 );
 
         // Add titles for stage details
 
@@ -628,7 +509,7 @@
 
         if ( type == Program.SINGLE_EVENT_WITH_REGISTRATION )
         {
-            // Add a new program-instance
+            // Add a new program instance
             programInstance = new ProgramInstance();
             programInstance.setEnrollmentDate( executionDate );
             programInstance.setDateOfIncident( executionDate );
@@ -643,7 +524,7 @@
             Collection<ProgramInstance> programInstances = programInstanceService.getProgramInstances( program );
             if ( programInstances == null || programInstances.size() == 0 )
             {
-                // Add a new program-instance if it doesn't exist
+                // Add a new program instance if it doesn't exist
                 programInstance = new ProgramInstance();
                 programInstance.setEnrollmentDate( executionDate );
                 programInstance.setDateOfIncident( executionDate );
@@ -657,7 +538,7 @@
             }
         }
 
-        // Add a new program-stage-instance
+        // Add a new program stage instance
         ProgramStageInstance programStageInstance = new ProgramStageInstance();
         programStageInstance.setProgramInstance( programInstance );
         programStageInstance.setProgramStage( programStage );
@@ -699,5 +580,4 @@
 
         return outboundSms;
     }
-
-}
\ No newline at end of file
+}

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/resources/META-INF/dhis/beans.xml	2014-05-07 10:09:11 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/resources/META-INF/dhis/beans.xml	2014-05-10 11:40:24 +0000
@@ -181,8 +181,6 @@
 		<property name="programStageInstanceStore"
 			ref="org.hisp.dhis.program.ProgramStageInstanceStore" />
 		<property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
-		<property name="dataValueService"
-			ref="org.hisp.dhis.trackedentitydatavalue.TrackedEntityDataValueService" />
 		<property name="smsSender" ref="org.hisp.dhis.sms.SmsSender" />
 		<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
 		<property name="reminderService"