← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19736: Javadocs

 

------------------------------------------------------------
revno: 19736
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-08-06 22:09:10 +0200
message:
  Javadocs
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstanceService.java
  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/DefaultProgramInstanceService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/AbstractEnrollmentService.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/ProgramInstanceService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstanceService.java	2015-08-06 17:12:37 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramInstanceService.java	2015-08-06 20:09:10 +0000
@@ -335,7 +335,20 @@
     /**
      * Enroll a TrackedEntityInstance into a program. Must be run inside a transaction.
      *
+     * @param trackedEntityInstance TrackedEntityInstance
+     * @param program               Program
+     * @param enrollmentDate        The date of enrollment
+     * @param dateOfIncident        The date of incident
+     * @param orgunit               Organisation Unit
      * @param uid                   UID to use for new instance
+     * @return ProgramInstance
+     */
+    ProgramInstance enrollTrackedEntityInstance( TrackedEntityInstance trackedEntityInstance, Program program, 
+        Date enrollmentDate, Date dateOfIncident, OrganisationUnit orgunit, String uid );
+
+    /**
+     * Enroll a TrackedEntityInstance into a program. Must be run inside a transaction.
+     *
      * @param trackedEntityInstance TrackedEntityInstance
      * @param program               Program
      * @param enrollmentDate        The date of enrollment
@@ -343,20 +356,7 @@
      * @param orgunit               Organisation Unit
      * @return ProgramInstance
      */
-    ProgramInstance enrollTrackedEntityInstance( String uid, TrackedEntityInstance trackedEntityInstance, Program program, 
-        Date enrollmentDate, Date dateOfIncident, OrganisationUnit orgunit );
-
-    /**
-     * Enroll a TrackedEntityInstance into a program. Must be run inside a transaction.
-     *
-     * @param entityInstance TrackedEntityInstance
-     * @param program        Program
-     * @param enrollmentDate The date of enrollment
-     * @param dateOfIncident The date of incident
-     * @param orgunit        Organisation Unit
-     * @return ProgramInstance
-     */
-    ProgramInstance enrollTrackedEntityInstance( TrackedEntityInstance entityInstance, Program program, Date enrollmentDate, Date dateOfIncident,
+    ProgramInstance enrollTrackedEntityInstance( TrackedEntityInstance trackedEntityInstance, Program program, Date enrollmentDate, Date dateOfIncident,
         OrganisationUnit orgunit );
 
     /**

=== 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-06-16 13:17:59 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramStageInstanceService.java	2015-08-06 20:09:10 +0000
@@ -180,20 +180,28 @@
         OrganisationUnit organisationUnit );
 
     /**
-     * For the first case of an anonymous program, the program-instance doesn't
-     * exist, So system has to create a program-instance and
-     * program-stage-instance. The similar thing happens for single event with
-     * registration.
+     * Creates a program stage instance. Will create a program instance in case
+     * the program is single event.
      *
-     * @param entityInstance TrackedEntityInstance
-     * @param program Single event without registration
-     * @param executionDate Report date of the event
-     * @param organisationUnit Orgunit where the event happens
-     * @return ProgramStageInstance ProgramStageInstance object
+     * @param entityInstance the tracked entity instance.
+     * @param program the program.
+     * @param executionDate the report date of the event.
+     * @param organisationUnit the organisation unit where the event took place.
+     * @return ProgramStageInstance a ProgramStageInstance object.
      */
     ProgramStageInstance createProgramStageInstance( TrackedEntityInstance entityInstance, Program program,
         Date executionDate, OrganisationUnit organisationUnit );
 
+    /**
+     * Creates a program stage instance. 
+     *
+     * @param programInstance the program instance.
+     * @param programStage the program stage.
+     * @param enrollmentDate the enrollment date.
+     * @param dateOfIncident the date of incident.
+     * @param organisationUnit the organisation unit where the event took place.
+     * @return ProgramStageInstance a ProgramStageInstance object.
+     */
     ProgramStageInstance createProgramStageInstance( ProgramInstance programInstance, ProgramStage programStage,
         Date enrollmentDate, Date dateOfIncident, OrganisationUnit organisationUnit );
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java	2015-08-06 17:12:37 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramInstanceService.java	2015-08-06 20:09:10 +0000
@@ -634,16 +634,16 @@
     }
 
     @Override
-    public ProgramInstance enrollTrackedEntityInstance( TrackedEntityInstance entityInstance, Program program,
+    public ProgramInstance enrollTrackedEntityInstance( TrackedEntityInstance trackedEntityInstance, Program program,
         Date enrollmentDate, Date dateOfIncident, OrganisationUnit organisationUnit )
     {
-        return enrollTrackedEntityInstance( CodeGenerator.generateCode(), entityInstance, program, enrollmentDate,
-            dateOfIncident, organisationUnit );
+        return enrollTrackedEntityInstance( trackedEntityInstance, program, enrollmentDate,
+            dateOfIncident, organisationUnit, CodeGenerator.generateCode() );
     }
 
     @Override
-    public ProgramInstance enrollTrackedEntityInstance( String uid, TrackedEntityInstance trackedEntityInstance,
-        Program program, Date enrollmentDate, Date dateOfIncident, OrganisationUnit organisationUnit )
+    public ProgramInstance enrollTrackedEntityInstance( TrackedEntityInstance trackedEntityInstance,
+        Program program, Date enrollmentDate, Date dateOfIncident, OrganisationUnit organisationUnit, String uid )
     {
         // ---------------------------------------------------------------------
         // Add program instance

=== 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-07-15 09:45:45 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java	2015-08-06 20:09:10 +0000
@@ -395,12 +395,6 @@
         updateProgramStageInstance( programStageInstance );
     }
 
-    /**
-     * For the first case of an anonymous program, the program-instance doesn't
-     * exist, So system has to create a program-instance and
-     * program-stage-instance. The similar thing happens for single event with
-     * registration.
-     */
     @Override
     public ProgramStageInstance createProgramStageInstance( TrackedEntityInstance instance, Program program,
         Date executionDate, OrganisationUnit organisationUnit )
@@ -417,6 +411,7 @@
         if ( program.isWithoutRegistration()  )
         {
             Collection<ProgramInstance> programInstances = programInstanceService.getProgramInstances( program );
+            
             if ( programInstances == null || programInstances.size() == 0 )
             {
                 // Add a new program instance if it doesn't exist
@@ -500,6 +495,7 @@
         if ( phoneNumbers.size() > 0 )
         {
             String msg = reminderService.getMessageFromTemplate( reminder, programStageInstance, format );
+            
             try
             {
                 outboundSms = new OutboundSms();

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/AbstractEnrollmentService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/AbstractEnrollmentService.java	2015-08-02 14:29:38 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/AbstractEnrollmentService.java	2015-08-06 20:09:10 +0000
@@ -281,8 +281,8 @@
 
         OrganisationUnit organisationUnit = getOrganisationUnit( enrollment.getOrgUnit() );
 
-        ProgramInstance programInstance = programInstanceService.enrollTrackedEntityInstance( enrollment.getEnrollment(), entityInstance, program,
-            enrollment.getDateOfEnrollment(), enrollment.getDateOfIncident(), organisationUnit );
+        ProgramInstance programInstance = programInstanceService.enrollTrackedEntityInstance( entityInstance, program,
+            enrollment.getDateOfEnrollment(), enrollment.getDateOfIncident(), organisationUnit, enrollment.getEnrollment() );
 
         if ( programInstance == null )
         {