← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14252: support trackedEntity property on trackedEntityInstance, validates and sets on creation of new Tr...

 

------------------------------------------------------------
revno: 14252
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-03-17 14:36:52 +0100
message:
  support trackedEntity property on trackedEntityInstance, validates and sets on creation of new TrackedEntityInstance
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/AbstractTrackedEntityInstanceService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/TrackedEntityInstanceService.java
  dhis-2/dhis-services/dhis-service-eventreporting/src/test/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionServiceTest.java
  dhis-2/dhis-services/dhis-service-eventreporting/src/test/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionStoreTest.java
  dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java
  dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramExpressionServiceTest.java
  dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramIndicatorServiceTest.java
  dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramInstanceServiceTest.java
  dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramInstanceStoreTest.java
  dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramStageInstanceServiceTest.java
  dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramStageInstanceStoreTest.java
  dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramValidationServiceTest.java
  dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/relationship/RelationshipServiceTest.java
  dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/relationship/RelationshipStoreTest.java
  dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityAuditServiceTest.java
  dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityAuditStoreTest.java
  dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceReminderServiceTest.java
  dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceServiceTest.java
  dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueServiceTest.java
  dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueStoreTest.java
  dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentitydatavalue/TrackedEntityDataValueServiceTest.java
  dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentitydatavalue/TrackedEntityDataValueStoreTest.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/RegisterTrackedEntityInstanceLocationAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/RegisterPatientLocationAction.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-03-17 11:30:30 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceService.java	2014-03-17 13:36:52 +0000
@@ -65,7 +65,7 @@
      * 
      * @return A generated unique id of the added {@link TrackedEntityInstance}.
      */
-    int saveTrackedEntityInstance( TrackedEntityInstance entityInstance );
+    int addTrackedEntityInstance( TrackedEntityInstance entityInstance );
 
     /**
      * Deletes a {@link TrackedEntityInstance}.

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/AbstractTrackedEntityInstanceService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/AbstractTrackedEntityInstanceService.java	2014-03-17 13:28:21 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/AbstractTrackedEntityInstanceService.java	2014-03-17 13:36:52 +0000
@@ -28,12 +28,6 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
 import org.hisp.dhis.common.IdentifiableObjectManager;
 import org.hisp.dhis.dxf2.importsummary.ImportConflict;
 import org.hisp.dhis.dxf2.importsummary.ImportStatus;
@@ -42,12 +36,20 @@
 import org.hisp.dhis.relationship.Relationship;
 import org.hisp.dhis.relationship.RelationshipService;
 import org.hisp.dhis.relationship.RelationshipType;
+import org.hisp.dhis.trackedentity.TrackedEntity;
 import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
+import org.hisp.dhis.trackedentity.TrackedEntityService;
 import org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValue;
 import org.hisp.dhis.trackedentityattributevalue.TrackedEntityAttributeValueService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.util.Assert;
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */
@@ -59,7 +61,7 @@
     // -------------------------------------------------------------------------
 
     @Autowired
-    private org.hisp.dhis.trackedentity.TrackedEntityInstanceService entityInstanceService;
+    private org.hisp.dhis.trackedentity.TrackedEntityInstanceService trackedEntityInstanceService;
 
     @Autowired
     private TrackedEntityAttributeValueService attributeValueService;
@@ -68,6 +70,9 @@
     private RelationshipService relationshipService;
 
     @Autowired
+    private TrackedEntityService trackedEntityService;
+
+    @Autowired
     private IdentifiableObjectManager manager;
 
     // -------------------------------------------------------------------------
@@ -77,7 +82,7 @@
     @Override
     public TrackedEntityInstance getTrackedEntityInstance( String uid )
     {
-        return getTrackedEntityInstance( entityInstanceService.getTrackedEntityInstance( uid ) );
+        return getTrackedEntityInstance( trackedEntityInstanceService.getTrackedEntityInstance( uid ) );
     }
 
     @Override
@@ -132,9 +137,11 @@
 
         OrganisationUnit organisationUnit = manager.get( OrganisationUnit.class, trackedEntityInstance.getOrgUnit() );
         Assert.notNull( organisationUnit );
-
         entityInstance.setOrganisationUnit( organisationUnit );
 
+        TrackedEntity trackedEntity = trackedEntityService.getTrackedEntity( trackedEntityInstance.getTrackedEntity() );
+        entityInstance.setTrackedEntity( trackedEntity );
+
         return entityInstance;
     }
 
@@ -149,6 +156,7 @@
         importSummary.setDataValueCount( null );
 
         List<ImportConflict> importConflicts = new ArrayList<ImportConflict>();
+        importConflicts.addAll( checkTrackedEntity( trackedEntityInstance ) );
         importConflicts.addAll( checkAttributes( trackedEntityInstance ) );
 
         importSummary.setConflicts( importConflicts );
@@ -161,10 +169,10 @@
         }
 
         org.hisp.dhis.trackedentity.TrackedEntityInstance entityInstance = getTrackedEntityInstance( trackedEntityInstance );
-        entityInstanceService.saveTrackedEntityInstance( entityInstance );
+        trackedEntityInstanceService.addTrackedEntityInstance( entityInstance );
 
         updateAttributeValues( trackedEntityInstance, entityInstance );
-        entityInstanceService.updateTrackedEntityInstance( entityInstance );
+        trackedEntityInstanceService.updateTrackedEntityInstance( entityInstance );
 
         importSummary.setStatus( ImportStatus.SUCCESS );
         importSummary.setReference( entityInstance.getUid() );
@@ -214,11 +222,11 @@
 
         removeRelationships( entityInstance );
         removeAttributeValues( entityInstance );
-        entityInstanceService.updateTrackedEntityInstance( entityInstance );
+        trackedEntityInstanceService.updateTrackedEntityInstance( entityInstance );
 
         updateRelationships( trackedEntityInstance, entityInstance );
         updateAttributeValues( trackedEntityInstance, entityInstance );
-        entityInstanceService.updateTrackedEntityInstance( entityInstance );
+        trackedEntityInstanceService.updateTrackedEntityInstance( entityInstance );
 
         importSummary.setStatus( ImportStatus.SUCCESS );
         importSummary.setReference( entityInstance.getUid() );
@@ -234,11 +242,11 @@
     @Override
     public void deleteTrackedEntityInstance( TrackedEntityInstance trackedEntityInstance )
     {
-        org.hisp.dhis.trackedentity.TrackedEntityInstance entityInstance = entityInstanceService.getTrackedEntityInstance( trackedEntityInstance.getTrackedEntityInstance() );
+        org.hisp.dhis.trackedentity.TrackedEntityInstance entityInstance = trackedEntityInstanceService.getTrackedEntityInstance( trackedEntityInstance.getTrackedEntityInstance() );
 
         if ( entityInstance != null )
         {
-            entityInstanceService.deleteTrackedEntityInstance( entityInstance );
+            trackedEntityInstanceService.deleteTrackedEntityInstance( entityInstance );
         }
         else
         {
@@ -250,6 +258,27 @@
     // HELPERS
     // -------------------------------------------------------------------------
 
+    private List<ImportConflict> checkTrackedEntity( TrackedEntityInstance trackedEntityInstance )
+    {
+        List<ImportConflict> importConflicts = new ArrayList<ImportConflict>();
+
+        if ( trackedEntityInstance.getTrackedEntity() == null )
+        {
+            importConflicts.add( new ImportConflict( "TrackedEntityInstance.trackedEntity", "Missing required property trackedEntity" ) );
+            return importConflicts;
+        }
+
+        TrackedEntity trackedEntity = trackedEntityService.getTrackedEntity( trackedEntityInstance.getTrackedEntity() );
+
+        if ( trackedEntity == null )
+        {
+            importConflicts.add( new ImportConflict( "TrackedEntityInstance.trackedEntity", "Invalid trackedEntity" +
+                trackedEntityInstance.getTrackedEntity() ) );
+        }
+
+        return importConflicts;
+    }
+
     private List<ImportConflict> checkAttributes( TrackedEntityInstance trackedEntityInstance )
     {
         List<ImportConflict> importConflicts = new ArrayList<ImportConflict>();
@@ -370,6 +399,6 @@
             attributeValueService.deleteTrackedEntityAttributeValue( trackedEntityAttributeValue );
         }
 
-        entityInstanceService.updateTrackedEntityInstance( entityInstance );
+        trackedEntityInstanceService.updateTrackedEntityInstance( entityInstance );
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/TrackedEntityInstanceService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/TrackedEntityInstanceService.java	2014-03-17 13:28:21 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/TrackedEntityInstanceService.java	2014-03-17 13:36:52 +0000
@@ -28,12 +28,12 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.hisp.dhis.dxf2.importsummary.ImportSummaries;
+import org.hisp.dhis.dxf2.importsummary.ImportSummary;
+
 import java.io.IOException;
 import java.io.InputStream;
 
-import org.hisp.dhis.dxf2.importsummary.ImportSummaries;
-import org.hisp.dhis.dxf2.importsummary.ImportSummary;
-
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */

=== modified file 'dhis-2/dhis-services/dhis-service-eventreporting/src/test/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionServiceTest.java'
--- dhis-2/dhis-services/dhis-service-eventreporting/src/test/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionServiceTest.java	2014-03-17 13:15:21 +0000
+++ dhis-2/dhis-services/dhis-service-eventreporting/src/test/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionServiceTest.java	2014-03-17 13:36:52 +0000
@@ -215,7 +215,7 @@
         // ---------------------------------------------------------------------
 
         TrackedEntityInstance entityInstance = createTrackedEntityInstance( 'A', organisationUnit );
-        entityInstanceService.saveTrackedEntityInstance( entityInstance );
+        entityInstanceService.addTrackedEntityInstance( entityInstance );
 
         // ---------------------------------------------------------------------
         // Attribue value

=== modified file 'dhis-2/dhis-services/dhis-service-eventreporting/src/test/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionStoreTest.java'
--- dhis-2/dhis-services/dhis-service-eventreporting/src/test/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionStoreTest.java	2014-03-17 13:15:21 +0000
+++ dhis-2/dhis-services/dhis-service-eventreporting/src/test/java/org/hisp/dhis/caseaggregation/CaseAggregationConditionStoreTest.java	2014-03-17 13:36:52 +0000
@@ -212,7 +212,7 @@
         // ---------------------------------------------------------------------
 
         TrackedEntityInstance entityInstance = createTrackedEntityInstance( 'A', organisationUnit );
-        entityInstanceService.saveTrackedEntityInstance( entityInstance );
+        entityInstanceService.addTrackedEntityInstance( entityInstance );
 
         // ---------------------------------------------------------------------
         // Attribue value

=== 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-03-17 12:07:44 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityInstanceService.java	2014-03-17 13:36:52 +0000
@@ -181,7 +181,7 @@
     }
     
     @Override
-    public int saveTrackedEntityInstance( TrackedEntityInstance instance )
+    public int addTrackedEntityInstance( TrackedEntityInstance instance )
     {
         return trackedEntityInstanceStore.save( instance );
     }
@@ -190,7 +190,7 @@
     public int createTrackedEntityInstance( TrackedEntityInstance instance, Integer representativeId,
         Integer relationshipTypeId, Set<TrackedEntityAttributeValue> attributeValues )
     {
-        int id = saveTrackedEntityInstance( instance );
+        int id = addTrackedEntityInstance( instance );
 
         for ( TrackedEntityAttributeValue pav : attributeValues )
         {

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramExpressionServiceTest.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramExpressionServiceTest.java	2014-02-07 20:25:49 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramExpressionServiceTest.java	2014-03-17 13:36:52 +0000
@@ -132,7 +132,7 @@
         deBId = dataElementService.addDataElement( dataElementB );
 
         TrackedEntityInstance entityInstance = createTrackedEntityInstance( 'A', organisationUnit );
-        entityInstanceService.saveTrackedEntityInstance( entityInstance );
+        entityInstanceService.addTrackedEntityInstance( entityInstance );
 
         ProgramInstance programInstance = programInstanceService.enrollTrackedEntityInstance( entityInstance, program, new Date(),
             new Date(), organisationUnit, null );

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramIndicatorServiceTest.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramIndicatorServiceTest.java	2014-02-07 20:25:49 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramIndicatorServiceTest.java	2014-03-17 13:36:52 +0000
@@ -120,7 +120,7 @@
         programService.addProgram( programB );
 
         TrackedEntityInstance entityInstance = createTrackedEntityInstance( 'A', organisationUnit );
-        entityInstanceService.saveTrackedEntityInstance( entityInstance );
+        entityInstanceService.addTrackedEntityInstance( entityInstance );
 
         Calendar calIncident = Calendar.getInstance();
         PeriodType.clearTimeOfDay( calIncident );

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramInstanceServiceTest.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramInstanceServiceTest.java	2014-03-17 13:15:21 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramInstanceServiceTest.java	2014-03-17 13:36:52 +0000
@@ -174,10 +174,10 @@
         programService.addProgram( programC );
 
         entityInstanceA = createTrackedEntityInstance( 'A', organisationUnitA );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA );
 
         TrackedEntityInstance entityInstanceB = createTrackedEntityInstance( 'B', organisationUnitB );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceB );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceB );
 
         Calendar calIncident = Calendar.getInstance();
         PeriodType.clearTimeOfDay( calIncident );

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramInstanceStoreTest.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramInstanceStoreTest.java	2014-02-07 20:25:49 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramInstanceStoreTest.java	2014-03-17 13:36:52 +0000
@@ -149,10 +149,10 @@
         programService.addProgram( programC );
 
         entityInstanceA = createTrackedEntityInstance( 'A', organisationUnitA );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA );
 
         TrackedEntityInstance entityInstanceB = createTrackedEntityInstance( 'B', organisationUnitB );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceB );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceB );
 
         Calendar calIncident = Calendar.getInstance();
         PeriodType.clearTimeOfDay( calIncident );

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramStageInstanceServiceTest.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramStageInstanceServiceTest.java	2014-03-17 13:15:21 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramStageInstanceServiceTest.java	2014-03-17 13:36:52 +0000
@@ -170,10 +170,10 @@
         orgunitBId = organisationUnitService.addOrganisationUnit( organisationUnitB );
 
         entityInstanceA = createTrackedEntityInstance( 'A', organisationUnitA );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA );
 
         entityInstanceB = createTrackedEntityInstance( 'B', organisationUnitB );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceB );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceB );
 
         TrackedEntityAttribute attribute = createTrackedEntityAttribute( 'A' );
         attribute.setValueType( TrackedEntityAttribute.TYPE_PHONE_NUMBER );

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramStageInstanceStoreTest.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramStageInstanceStoreTest.java	2014-02-07 20:25:49 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramStageInstanceStoreTest.java	2014-03-17 13:36:52 +0000
@@ -143,10 +143,10 @@
         orgunitBId = organisationUnitService.addOrganisationUnit( organisationUnitB );
 
         entityInstanceA = createTrackedEntityInstance( 'A', organisationUnitA );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA );
 
         entityInstanceB = createTrackedEntityInstance( 'B', organisationUnitB );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceB );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceB );
 
         /**
          * Program A

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramValidationServiceTest.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramValidationServiceTest.java	2014-02-07 20:25:49 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/program/ProgramValidationServiceTest.java	2014-03-17 13:36:52 +0000
@@ -144,7 +144,7 @@
         programStageDataElementService.addProgramStageDataElement( stageDataElementD );
 
         TrackedEntityInstance entityInstance = createTrackedEntityInstance( 'A', organisationUnit );
-        entityInstanceService.saveTrackedEntityInstance( entityInstance );
+        entityInstanceService.addTrackedEntityInstance( entityInstance );
 
         ProgramInstance programInstance = programInstanceService.enrollTrackedEntityInstance( entityInstance, program, new Date(),
             new Date(), organisationUnit, null );

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/relationship/RelationshipServiceTest.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/relationship/RelationshipServiceTest.java	2014-03-17 12:55:35 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/relationship/RelationshipServiceTest.java	2014-03-17 13:36:52 +0000
@@ -85,16 +85,16 @@
         organisationUnitService.addOrganisationUnit( organisationUnit );
 
         entityInstanceA = createTrackedEntityInstance( 'A', organisationUnit );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA );
 
         entityInstanceB = createTrackedEntityInstance( 'B', organisationUnit );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceB );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceB );
 
         entityInstanceC = createTrackedEntityInstance( 'C', organisationUnit );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceC );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceC );
 
         entityInstanceD = createTrackedEntityInstance( 'D', organisationUnit );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceD );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceD );
 
         relationshipType = createRelationshipType( 'A' );
         relationshipTypeService.addRelationshipType( relationshipType );

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/relationship/RelationshipStoreTest.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/relationship/RelationshipStoreTest.java	2014-03-17 12:55:35 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/relationship/RelationshipStoreTest.java	2014-03-17 13:36:52 +0000
@@ -83,16 +83,16 @@
         organisationUnitService.addOrganisationUnit( organisationUnit );
 
         entityInstanceA = createTrackedEntityInstance( 'A', organisationUnit );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA );
 
         entityInstanceB = createTrackedEntityInstance( 'B', organisationUnit );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceB );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceB );
 
         entityInstanceC = createTrackedEntityInstance( 'C', organisationUnit );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceC );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceC );
 
         entityInstanceD = createTrackedEntityInstance( 'D', organisationUnit );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceD );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceD );
 
         relationshipType = createRelationshipType( 'A' );
         relationshipTypeService.addRelationshipType( relationshipType );

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityAuditServiceTest.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityAuditServiceTest.java	2014-02-07 20:25:49 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityAuditServiceTest.java	2014-03-17 13:36:52 +0000
@@ -40,10 +40,6 @@
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.period.PeriodType;
-import org.hisp.dhis.trackedentity.TrackedEntityInstance;
-import org.hisp.dhis.trackedentity.TrackedEntityAudit;
-import org.hisp.dhis.trackedentity.TrackedEntityAuditService;
-import org.hisp.dhis.trackedentity.TrackedEntityInstanceService;
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 
@@ -85,10 +81,10 @@
         organisationUnitService.addOrganisationUnit( organisationUnit );
 
         entityInstanceA = createTrackedEntityInstance( 'A', organisationUnit );
-        entityInstanceAId = entityInstanceService.saveTrackedEntityInstance( entityInstanceA );
+        entityInstanceAId = entityInstanceService.addTrackedEntityInstance( entityInstanceA );
 
         entityInstanceB = createTrackedEntityInstance( 'B', organisationUnit );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceB );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceB );
 
         Calendar cal = Calendar.getInstance();
         PeriodType.clearTimeOfDay( cal );

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityAuditStoreTest.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityAuditStoreTest.java	2014-02-07 20:25:49 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityAuditStoreTest.java	2014-03-17 13:36:52 +0000
@@ -38,10 +38,6 @@
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.period.PeriodType;
-import org.hisp.dhis.trackedentity.TrackedEntityInstance;
-import org.hisp.dhis.trackedentity.TrackedEntityAudit;
-import org.hisp.dhis.trackedentity.TrackedEntityAuditStore;
-import org.hisp.dhis.trackedentity.TrackedEntityInstanceService;
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 
@@ -83,10 +79,10 @@
         organisationUnitService.addOrganisationUnit( organisationUnit );
 
         entityInstanceA = createTrackedEntityInstance( 'A', organisationUnit );
-        entityInstanceAId = entityInstanceService.saveTrackedEntityInstance( entityInstanceA );
+        entityInstanceAId = entityInstanceService.addTrackedEntityInstance( entityInstanceA );
 
         entityInstanceB = createTrackedEntityInstance( 'B', organisationUnit );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceB );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceB );
 
         Calendar cal = Calendar.getInstance();
         PeriodType.clearTimeOfDay( cal );

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceReminderServiceTest.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceReminderServiceTest.java	2014-03-17 13:15:21 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceReminderServiceTest.java	2014-03-17 13:36:52 +0000
@@ -127,7 +127,7 @@
         userService.addUser( user );
 
         entityInstance = createTrackedEntityInstance( 'A', organisationUnit );
-        entityInstanceService.saveTrackedEntityInstance( entityInstance );
+        entityInstanceService.addTrackedEntityInstance( entityInstance );
 
         Program program = createProgram( 'A', new HashSet<ProgramStage>(), organisationUnit );
         reminderA = new TrackedEntityInstanceReminder( "A", 0, "Test program message template",

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceServiceTest.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceServiceTest.java	2014-03-17 13:15:21 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentity/TrackedEntityInstanceServiceTest.java	2014-03-17 13:36:52 +0000
@@ -134,8 +134,8 @@
     @Test
     public void testSaveTrackedEntityInstance()
     {
-        int idA = entityInstanceService.saveTrackedEntityInstance( entityInstanceA1 );
-        int idB = entityInstanceService.saveTrackedEntityInstance( entityInstanceB1 );
+        int idA = entityInstanceService.addTrackedEntityInstance( entityInstanceA1 );
+        int idB = entityInstanceService.addTrackedEntityInstance( entityInstanceB1 );
 
         assertNotNull( entityInstanceService.getTrackedEntityInstance( idA ) );
         assertNotNull( entityInstanceService.getTrackedEntityInstance( idB ) );
@@ -144,8 +144,8 @@
     @Test
     public void testDeleteTrackedEntityInstance()
     {
-        int idA = entityInstanceService.saveTrackedEntityInstance( entityInstanceA1 );
-        int idB = entityInstanceService.saveTrackedEntityInstance( entityInstanceB1 );
+        int idA = entityInstanceService.addTrackedEntityInstance( entityInstanceA1 );
+        int idB = entityInstanceService.addTrackedEntityInstance( entityInstanceB1 );
 
         assertNotNull( entityInstanceService.getTrackedEntityInstance( idA ) );
         assertNotNull( entityInstanceService.getTrackedEntityInstance( idB ) );
@@ -164,7 +164,7 @@
     @Test
     public void testUpdateTrackedEntityInstance()
     {
-        int idA = entityInstanceService.saveTrackedEntityInstance( entityInstanceA1 );
+        int idA = entityInstanceService.addTrackedEntityInstance( entityInstanceA1 );
 
         assertNotNull( entityInstanceService.getTrackedEntityInstance( idA ) );
 
@@ -177,8 +177,8 @@
     @Test
     public void testGetTrackedEntityInstanceById()
     {
-        int idA = entityInstanceService.saveTrackedEntityInstance( entityInstanceA1 );
-        int idB = entityInstanceService.saveTrackedEntityInstance( entityInstanceB1 );
+        int idA = entityInstanceService.addTrackedEntityInstance( entityInstanceA1 );
+        int idB = entityInstanceService.addTrackedEntityInstance( entityInstanceB1 );
 
         assertEquals( entityInstanceA1, entityInstanceService.getTrackedEntityInstance( idA ) );
         assertEquals( entityInstanceB1, entityInstanceService.getTrackedEntityInstance( idB ) );
@@ -190,8 +190,8 @@
         entityInstanceA1.setUid( "A1" );
         entityInstanceB1.setUid( "B1" );
 
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA1 );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceB1 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA1 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceB1 );
 
         assertEquals( entityInstanceA1, entityInstanceService.getTrackedEntityInstance( "A1" ) );
         assertEquals( entityInstanceB1, entityInstanceService.getTrackedEntityInstance( "B1" ) );
@@ -200,8 +200,8 @@
     @Test
     public void testGetAllTrackedEntityInstances()
     {
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA1 );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceB1 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA1 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceB1 );
 
         assertTrue( equals( entityInstanceService.getAllTrackedEntityInstances(), entityInstanceA1, entityInstanceB1 ) );
     }
@@ -209,9 +209,9 @@
     @Test
     public void testGetTrackedEntityInstancesByOu()
     {
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA1 );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA2 );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA3 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA1 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA2 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA3 );
 
         Collection<TrackedEntityInstance> entityInstances = entityInstanceService.getTrackedEntityInstances( organisationUnit, null, null );
         assertEquals( 2, entityInstances.size() );
@@ -224,9 +224,9 @@
     {
         programService.addProgram( programA );
 
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA1 );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA2 );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA3 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA1 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA2 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA3 );
 
         programInstanceService.enrollTrackedEntityInstance( entityInstanceA1, programA, date, date, organisationUnit, null );
         programInstanceService.enrollTrackedEntityInstance( entityInstanceA3, programA, date, date, organisationUnit, null );
@@ -242,9 +242,9 @@
     {
         programService.addProgram( programA );
 
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA1 );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA2 );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA3 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA1 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA2 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA3 );
 
         programInstanceService.enrollTrackedEntityInstance( entityInstanceA1, programA, date, date, organisationUnit, null );
         programInstanceService.enrollTrackedEntityInstance( entityInstanceA2, programA, date, date, organisationUnit, null );
@@ -259,10 +259,10 @@
     @Test
     public void testGetTrackedEntityInstancesByAttribute()
     {
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA2 );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA3 );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceB1 );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceB2 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA2 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA3 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceB1 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceB2 );
 
         TrackedEntityAttributeValue attributeValue = createTrackedEntityAttributeValue( 'A', entityInstanceA3,
             entityInstanceAttribute );
@@ -287,10 +287,10 @@
         programService.addProgram( programA );
         programService.addProgram( programB );
 
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA1 );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceB1 );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA2 );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceB2 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA1 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceB1 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA2 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceB2 );
 
         programInstanceService.enrollTrackedEntityInstance( entityInstanceA1, programA, date, date, organisationUnit, null );
         programInstanceService.enrollTrackedEntityInstance( entityInstanceB1, programA, date, date, organisationUnit, null );
@@ -313,13 +313,13 @@
     @Test
     public void testGetRepresentatives()
     {
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceB1 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceB1 );
 
         entityInstanceA1.setRepresentative( entityInstanceB1 );
         entityInstanceA2.setRepresentative( entityInstanceB1 );
 
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA1 );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA2 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA1 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA2 );
 
         assertEquals( 2, entityInstanceService.getRepresentatives( entityInstanceB1 ).size() );
     }
@@ -327,7 +327,7 @@
     @Test
     public void testCreateTrackedEntityInstanceAndRelative()
     {
-        int idB = entityInstanceService.saveTrackedEntityInstance( entityInstanceB1 );
+        int idB = entityInstanceService.addTrackedEntityInstance( entityInstanceB1 );
 
         RelationshipType relationshipType = createRelationshipType( 'A' );
         int relationshipTypeId = relationshipTypeService.addRelationshipType( relationshipType );
@@ -344,7 +344,7 @@
     @Test
     public void testUpdateTrackedEntityInstanceAndRelative()
     {
-        int idB = entityInstanceService.saveTrackedEntityInstance( entityInstanceB1 );
+        int idB = entityInstanceService.addTrackedEntityInstance( entityInstanceB1 );
 
         RelationshipType relationshipType = createRelationshipType( 'A' );
         int relationshipTypeId = relationshipTypeService.addRelationshipType( relationshipType );
@@ -369,9 +369,9 @@
     @Test
     public void testCountGetTrackedEntityInstancesByOrgUnit()
     {
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA1 );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA2 );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA3 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA1 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA2 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA3 );
 
         assertEquals( 2, entityInstanceService.countGetTrackedEntityInstancesByOrgUnit( organisationUnit ) );
     }
@@ -382,10 +382,10 @@
         programService.addProgram( programA );
         programService.addProgram( programB );
 
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA1 );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceB1 );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA2 );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceB2 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA1 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceB1 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA2 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceB2 );
 
         programInstanceService.enrollTrackedEntityInstance( entityInstanceA1, programA, date, date, organisationUnit, null );
         programInstanceService.enrollTrackedEntityInstance( entityInstanceB1, programA, date, date, organisationUnit, null );
@@ -402,11 +402,11 @@
         int idA = programService.addProgram( programA );
         programService.addProgram( programB );
 
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA1 );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA2 );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA3 );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceB1 );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceB2 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA1 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA2 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA3 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceB1 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceB2 );
 
         TrackedEntityAttributeValue attributeValue = createTrackedEntityAttributeValue( 'A', entityInstanceA3,
             entityInstanceAttribute );
@@ -437,11 +437,11 @@
         int idA = programService.addProgram( programA );
         programService.addProgram( programB );
 
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA1 );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA2 );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA3 );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceB1 );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceB2 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA1 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA2 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA3 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceB1 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceB2 );
 
         TrackedEntityAttributeValue attributeValue = createTrackedEntityAttributeValue( 'A', entityInstanceA3,
             entityInstanceAttribute );
@@ -468,11 +468,11 @@
         int idA = programService.addProgram( programA );
         programService.addProgram( programB );
 
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA1 );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA2 );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA3 );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceB1 );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceB2 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA1 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA2 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA3 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceB1 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceB2 );
 
         TrackedEntityAttribute phoneAttribute = createTrackedEntityAttribute( 'B' );
         phoneAttribute.setValueType( TrackedEntityAttribute.TYPE_PHONE_NUMBER );
@@ -505,9 +505,9 @@
     @Test
     public void testGetTrackedEntityInstancesByPhone()
     {
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA1 );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA2 );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceA3 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA1 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA2 );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA3 );
 
         TrackedEntityAttribute entityInstanceAttribute = createTrackedEntityAttribute( 'B' );
         entityInstanceAttribute.setValueType( TrackedEntityAttribute.TYPE_PHONE_NUMBER );

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueServiceTest.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueServiceTest.java	2014-03-17 13:15:21 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueServiceTest.java	2014-03-17 13:36:52 +0000
@@ -111,10 +111,10 @@
         entityInstanceC = createTrackedEntityInstance( 'C', organisationUnit );
         entityInstanceD = createTrackedEntityInstance( 'D', organisationUnit );
 
-        entityInstanceAId = entityInstanceService.saveTrackedEntityInstance( entityInstanceA );
-        entityInstanceBId = entityInstanceService.saveTrackedEntityInstance( entityInstanceB );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceC );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceD );
+        entityInstanceAId = entityInstanceService.addTrackedEntityInstance( entityInstanceA );
+        entityInstanceBId = entityInstanceService.addTrackedEntityInstance( entityInstanceB );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceC );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceD );
 
         attributeA = createTrackedEntityAttribute( 'A' );
         attributeB = createTrackedEntityAttribute( 'B' );

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueStoreTest.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueStoreTest.java	2014-03-17 13:15:21 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentityattributevalue/TrackedEntityAttributeValueStoreTest.java	2014-03-17 13:36:52 +0000
@@ -105,10 +105,10 @@
         entityInstanceC = createTrackedEntityInstance( 'C', organisationUnit );
         entityInstanceD = createTrackedEntityInstance( 'D', organisationUnit );
 
-        entityInstanceService.saveTrackedEntityInstance(  entityInstanceA );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceB );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceC );
-        entityInstanceService.saveTrackedEntityInstance( entityInstanceD );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceA );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceB );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceC );
+        entityInstanceService.addTrackedEntityInstance( entityInstanceD );
 
         attributeA = createTrackedEntityAttribute(  'A' );
         attributeB = createTrackedEntityAttribute( 'B' );

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentitydatavalue/TrackedEntityDataValueServiceTest.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentitydatavalue/TrackedEntityDataValueServiceTest.java	2014-02-07 20:25:49 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentitydatavalue/TrackedEntityDataValueServiceTest.java	2014-03-17 13:36:52 +0000
@@ -53,8 +53,6 @@
 import org.hisp.dhis.program.ProgramStageService;
 import org.hisp.dhis.trackedentity.TrackedEntityInstance;
 import org.hisp.dhis.trackedentity.TrackedEntityInstanceService;
-import org.hisp.dhis.trackedentitydatavalue.TrackedEntityDataValue;
-import org.hisp.dhis.trackedentitydatavalue.TrackedEntityDataValueService;
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 
@@ -127,7 +125,7 @@
         dataElementService.addDataElement( dataElementB );
 
         entityInstance = createTrackedEntityInstance(  'A', organisationUnit );
-        entityInstanceService.saveTrackedEntityInstance( entityInstance );
+        entityInstanceService.addTrackedEntityInstance( entityInstance );
 
         Program program = createProgram( 'A', new HashSet<ProgramStage>(), organisationUnit );
         programService.addProgram( program );

=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentitydatavalue/TrackedEntityDataValueStoreTest.java'
--- dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentitydatavalue/TrackedEntityDataValueStoreTest.java	2014-02-07 20:25:49 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/test/java/org/hisp/dhis/trackedentitydatavalue/TrackedEntityDataValueStoreTest.java	2014-03-17 13:36:52 +0000
@@ -53,8 +53,6 @@
 import org.hisp.dhis.program.ProgramStageService;
 import org.hisp.dhis.trackedentity.TrackedEntityInstance;
 import org.hisp.dhis.trackedentity.TrackedEntityInstanceService;
-import org.hisp.dhis.trackedentitydatavalue.TrackedEntityDataValue;
-import org.hisp.dhis.trackedentitydatavalue.TrackedEntityDataValueStore;
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 
@@ -127,7 +125,7 @@
         dataElementService.addDataElement( dataElementB );
 
         entityInstance = createTrackedEntityInstance( 'A', organisationUnit );
-        entityInstanceService.saveTrackedEntityInstance( entityInstance );
+        entityInstanceService.addTrackedEntityInstance( entityInstance );
 
         Program program = createProgram( 'A', new HashSet<ProgramStage>(), organisationUnit );
         programService.addProgram( program );

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/RegisterTrackedEntityInstanceLocationAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/RegisterTrackedEntityInstanceLocationAction.java	2014-02-07 20:25:49 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/trackedentity/RegisterTrackedEntityInstanceLocationAction.java	2014-03-17 13:36:52 +0000
@@ -85,7 +85,7 @@
 
         entityInstance.setOrganisationUnit( orgunit );
         
-        entityInstanceService.saveTrackedEntityInstance( entityInstance );
+        entityInstanceService.addTrackedEntityInstance( entityInstance );
 
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/RegisterPatientLocationAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/RegisterPatientLocationAction.java	2014-02-07 20:25:49 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/namebaseddataentry/action/RegisterPatientLocationAction.java	2014-03-17 13:36:52 +0000
@@ -89,7 +89,7 @@
     {
         TrackedEntityInstance patient = patientService.getTrackedEntityInstance( patientId );
         patient.setOrganisationUnit( organisationUnitService.getOrganisationUnit( orgUnitId ) );
-        patientService.saveTrackedEntityInstance( patient );
+        patientService.addTrackedEntityInstance( patient );
 
         return SUCCESS;
     }