← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20078: Removed code

 

------------------------------------------------------------
revno: 20078
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-09-10 12:49:55 +0200
message:
  Removed code
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramStageInstanceServiceTest.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/program/ProgramStageInstanceService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java	2015-08-06 20:09:10 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java	2015-09-10 10:49:55 +0000
@@ -32,9 +32,7 @@
 import java.util.Date;
 import java.util.List;
 
-import org.hisp.dhis.common.Grid;
 import org.hisp.dhis.event.EventStatus;
-import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
@@ -134,33 +132,6 @@
     Collection<SchedulingProgramObject> getSendMesssageEvents();
 
     /**
-     * Get/export statistical report of a program
-     *
-     * @param program Program needs to report
-     * @param orgunitIds The ids of orgunits where the events happened
-     * @param startDate Optional date the instance should be on or after.
-     * @param endDate Optional date the instance should be on or before.
-     * @param i18n I18n object
-     * @param format I18nFormat
-     * @return Program report
-     */
-    Grid getStatisticalReport( Program program, Collection<Integer> orgunitIds, Date startDate, Date endDate,
-        I18n i18n, I18nFormat format );
-
-    /**
-     * Get/Export a report about the number of events of a program completed on
-     * a orgunit
-     *
-     * @param orgunits The ids of orgunits where the events happened
-     * @param program The program needs for reporting
-     * @param startDate Optional date the instance should be on or after.
-     * @param endDate Optional date the instance should be on or before.
-     * @return Grid
-     */
-    Grid getCompletenessProgramStageInstance( Collection<Integer> orgunits, Program program, String startDate,
-        String endDate, I18n i18n );
-
-    /**
      * Complete an event. Besides, program template messages will be send if it
      * was defined to send when to complete this program
      *
@@ -170,16 +141,6 @@
     void completeProgramStageInstance( ProgramStageInstance programStageInstance, I18nFormat format );
 
     /**
-     * Set report date and orgunit where an event happened for the event
-     *
-     * @param programStageInstance ProgramStageInstance
-     * @param executionDate Report date
-     * @param organisationUnit Orgunit where the event happens
-     */
-    void setExecutionDate( ProgramStageInstance programStageInstance, Date executionDate,
-        OrganisationUnit organisationUnit );
-
-    /**
      * Creates a program stage instance. Will create a program instance in case
      * the program is single event.
      *

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java	2015-09-03 08:15:09 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java	2015-09-10 10:49:55 +0000
@@ -36,10 +36,7 @@
 import java.util.List;
 import java.util.Set;
 
-import org.hisp.dhis.common.Grid;
-import org.hisp.dhis.common.GridHeader;
 import org.hisp.dhis.event.EventStatus;
-import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.message.MessageConversation;
 import org.hisp.dhis.message.MessageService;
@@ -48,9 +45,7 @@
 import org.hisp.dhis.sms.SmsSender;
 import org.hisp.dhis.sms.SmsServiceException;
 import org.hisp.dhis.sms.outbound.OutboundSms;
-import org.hisp.dhis.system.grid.ListGrid;
 import org.hisp.dhis.system.util.DateUtils;
-import org.hisp.dhis.system.util.MathUtils;
 import org.hisp.dhis.trackedentity.TrackedEntityInstance;
 import org.hisp.dhis.trackedentity.TrackedEntityInstanceReminder;
 import org.hisp.dhis.trackedentity.TrackedEntityInstanceReminderService;
@@ -181,144 +176,6 @@
     }
 
     @Override
-    public Grid getStatisticalReport( Program program, Collection<Integer> orgunitIds, Date startDate, Date endDate,
-        I18n i18n, I18nFormat format )
-    {
-        Grid grid = new ListGrid();
-        grid.setTitle( i18n.getString( "program_overview" ) + " - " + program.getDisplayName() );
-        grid.setSubtitle( i18n.getString( "from" ) + " " + format.formatDate( startDate ) + "  "
-            + i18n.getString( "to" ) + " " + format.formatDate( endDate ) );
-
-        grid.addHeader( new GridHeader( "", false, true ) );
-        grid.addHeader( new GridHeader( "", false, false ) );
-        grid.addHeader( new GridHeader( "", false, false ) );
-        grid.addHeader( new GridHeader( "", false, false ) );
-        grid.addHeader( new GridHeader( "", false, false ) );
-        grid.addHeader( new GridHeader( "", false, false ) );
-        grid.addHeader( new GridHeader( "", false, false ) );
-        grid.addHeader( new GridHeader( "", false, false ) );
-
-        // Total new enrollments in the period
-
-        int total = programInstanceService.countProgramInstances( program, orgunitIds, startDate, endDate );
-        grid.addRow();
-        grid.addValue( i18n.getString( "total_new_enrollments_in_this_period" ) );
-        grid.addValue( total ).addEmptyValues( 6 );
-
-        // Total programs completed in this period
-
-        int totalCompleted = programInstanceService.countProgramInstancesByStatus( ProgramInstance.STATUS_COMPLETED,
-            program, orgunitIds, startDate, endDate );
-        grid.addRow();
-        grid.addValue( i18n.getString( "total_programs_completed_in_this_period" ) );
-        grid.addValue( totalCompleted ).addEmptyValues( 6 );
-
-        // Total programs discontinued (un-enrollments)
-
-        int totalDiscontinued = programInstanceService.countProgramInstancesByStatus( ProgramInstance.STATUS_CANCELLED,
-            program, orgunitIds, startDate, endDate );
-        grid.addRow();
-        grid.addValue( i18n.getString( "total_programs_discontinued_unenrollments" ) );
-        grid.addValue( totalDiscontinued ).addEmptyValues( 6 );
-
-        // Average number of stages for complete programs
-
-        grid.addRow();
-        grid.addValue( i18n.getString( "average_number_of_stages_for_complete_programs" ) );
-        double percent = 0.0;
-        if ( totalCompleted != 0 )
-        {
-            int stageCompleted = programStageInstanceStore.averageNumberCompleted( program, orgunitIds, startDate,
-                endDate, ProgramInstance.STATUS_ACTIVE );
-            percent = (stageCompleted + 0.0) / totalCompleted;
-        }
-        grid.addValue( MathUtils.getRounded( percent ) ).addEmptyValues( 6 );
-
-        // Add empty row
-
-        grid.addRow().addEmptyValues( 8 );
-
-        // Summary by stage
-
-        grid.addRow();
-        grid.addValue( i18n.getString( "summary_by_stage" ) ).addEmptyValues( 7 );
-
-        // Add titles for stage details
-
-        grid.addRow();
-        grid.addValue( i18n.getString( "program_stages" ) );
-        grid.addValue( i18n.getString( "visits_scheduled_all" ) );
-        grid.addValue( i18n.getString( "visits_done" ) );
-        grid.addValue( i18n.getString( "visits_done_percent" ) );
-        grid.addValue( i18n.getString( "forms_completed" ) );
-        grid.addValue( i18n.getString( "forms_completed_percent" ) );
-        grid.addValue( i18n.getString( "visits_overdue" ) );
-        grid.addValue( i18n.getString( "visits_overdue_percent" ) );
-
-        // Add values for stage details
-
-        for ( ProgramStage programStage : program.getProgramStages() )
-        {
-            grid.addRow();
-            grid.addValue( programStage.getDisplayName() );
-
-            // Visits scheduled (All)
-            int totalAll = programStageInstanceStore.count( programStage, orgunitIds, startDate, endDate, null );
-            grid.addValue( totalAll );
-
-            // Visits done (#) = Incomplete + Complete stages.
-            int totalCompletedEvent = programStageInstanceStore.count( programStage, orgunitIds, startDate, endDate,
-                true );
-            int totalVisit = totalCompletedEvent
-                + programStageInstanceStore.count( programStage, orgunitIds, startDate, endDate, false );
-            grid.addValue( totalVisit );
-
-            // Visits done (%)
-
-            percent = 0.0;
-            if ( totalAll != 0 )
-            {
-                percent = (totalVisit + 0.0) * 100 / totalAll;
-            }
-            grid.addValue( MathUtils.getRounded( percent ) + "%" );
-
-            // Forms completed (#) = Program stage instances where the user has
-            // clicked complete.
-
-            grid.addValue( totalCompletedEvent );
-
-            // Forms completed (%)
-            if ( totalAll != 0 )
-            {
-                percent = (totalCompletedEvent + 0.0) * 100 / totalAll;
-            }
-            grid.addValue( MathUtils.getRounded( percent ) + "%" );
-
-            // Visits overdue (#)
-            int overdue = programStageInstanceStore.getOverDueCount( programStage, orgunitIds, startDate, endDate );
-            grid.addValue( overdue );
-
-            // Visits overdue (%)
-
-            percent = 0.0;
-            if ( totalAll != 0 )
-            {
-                percent = (overdue + 0.0) * 100 / totalAll;
-            }
-            grid.addValue( MathUtils.getRounded( percent ) + "%" );
-        }
-
-        return grid;
-    }
-
-    @Override
-    public Grid getCompletenessProgramStageInstance( Collection<Integer> orgunitIds, Program program, String startDate,
-        String endDate, I18n i18n )
-    {
-        return programStageInstanceStore.getCompleteness( orgunitIds, program, startDate, endDate, i18n );
-    }
-
-    @Override
     public void completeProgramStageInstance( ProgramStageInstance programStageInstance, I18nFormat format )
     {
         Calendar today = Calendar.getInstance();
@@ -381,21 +238,6 @@
     }
 
     @Override
-    public void setExecutionDate( ProgramStageInstance programStageInstance, Date executionDate,
-        OrganisationUnit organisationUnit )
-    {
-        programStageInstance.setExecutionDate( executionDate );
-        programStageInstance.setOrganisationUnit( organisationUnit );
-
-        if ( programStageInstance.getProgramInstance().getProgram().isWithoutRegistration() )
-        {
-            programStageInstance.setDueDate( executionDate );
-        }
-
-        updateProgramStageInstance( programStageInstance );
-    }
-
-    @Override
     public ProgramStageInstance createProgramStageInstance( TrackedEntityInstance instance, Program program,
         Date executionDate, OrganisationUnit organisationUnit )
     {

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramStageInstanceServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramStageInstanceServiceTest.java	2015-09-03 08:15:09 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/program/ProgramStageInstanceServiceTest.java	2015-09-10 10:49:55 +0000
@@ -447,18 +447,6 @@
     }
 
     @Test
-    public void testSetExecutionDate()
-    {
-        int idA = programStageInstanceService.addProgramStageInstance( programStageInstanceA );
-
-        programStageInstanceService.setExecutionDate( programStageInstanceA, enrollmentDate, organisationUnitA );
-
-        ProgramStageInstance programStageInstance = programStageInstanceService.getProgramStageInstance( idA );
-        assertEquals( enrollmentDate, programStageInstance.getExecutionDate() );
-        assertEquals( organisationUnitA, programStageInstance.getOrganisationUnit() );
-    }
-
-    @Test
     public void testCreateProgramStageInstance()
     {
         programA.setProgramType( ProgramType.WITHOUT_REGISTRATION );