← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12958: Added convenience methods on Patient for adding attribute values/identifiers through updating bot...

 

------------------------------------------------------------
revno: 12958
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-11-18 11:39:00 +0100
message:
  Added convenience methods on Patient for adding attribute values/identifiers through updating both sides of association
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/Patient.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/patient/Patient.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/Patient.java	2013-11-18 10:26:25 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/Patient.java	2013-11-18 10:39:00 +0000
@@ -400,6 +400,30 @@
 
         return AGE_TYPE_DAY;
     }
+    
+    public void addIdentifier( PatientIdentifier identifier )
+    {
+        identifiers.add( identifier );
+        identifier.setPatient( this );
+    }
+    
+    public void removeIdentifier( PatientIdentifier identifier )
+    {
+        identifiers.remove( identifier );
+        identifier.setPatient( null );
+    }
+    
+    public void addAttributeValue( PatientAttributeValue attributeValue )
+    {
+        attributeValues.add( attributeValue );
+        attributeValue.setPatient( this );
+    }
+    
+    public void removeAttributeValue( PatientAttributeValue attributeValue )
+    {
+        attributeValues.remove( attributeValue );
+        attributeValue.setPatient( null );
+    }
 
     // -------------------------------------------------------------------------
     // Getter && Setter