← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14261: add attributes to Enrollment class, not in use yet

 

------------------------------------------------------------
revno: 14261
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-03-17 16:40:04 +0100
message:
  add attributes to Enrollment class, not in use yet
modified:
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/Enrollment.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-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/Enrollment.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/Enrollment.java	2014-01-28 10:01:16 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/Enrollment.java	2014-03-17 15:40:04 +0000
@@ -32,8 +32,11 @@
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
 import org.hisp.dhis.common.DxfNamespaces;
+import org.hisp.dhis.dxf2.events.trackedentity.Attribute;
 
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.List;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -53,6 +56,8 @@
 
     private Date dateOfIncident;
 
+    private List<Attribute> attributes = new ArrayList<Attribute>();
+
     public Enrollment()
     {
     }
@@ -129,29 +134,33 @@
         this.dateOfIncident = dateOfIncident;
     }
 
+    @JsonProperty
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+    public List<Attribute> getAttributes()
+    {
+        return attributes;
+    }
+
+    public void setAttributes( List<Attribute> attributes )
+    {
+        this.attributes = attributes;
+    }
+
     @Override
     public boolean equals( Object o )
     {
-        if ( this == o )
-            return true;
-        if ( o == null || getClass() != o.getClass() )
-            return false;
+        if ( this == o ) return true;
+        if ( o == null || getClass() != o.getClass() ) return false;
 
         Enrollment that = (Enrollment) o;
 
-        if ( dateOfEnrollment != null ? !dateOfEnrollment.equals( that.dateOfEnrollment )
-            : that.dateOfEnrollment != null )
-            return false;
-        if ( dateOfIncident != null ? !dateOfIncident.equals( that.dateOfIncident ) : that.dateOfIncident != null )
-            return false;
-        if ( enrollment != null ? !enrollment.equals( that.enrollment ) : that.enrollment != null )
-            return false;
-        if ( person != null ? !person.equals( that.person ) : that.person != null )
-            return false;
-        if ( program != null ? !program.equals( that.program ) : that.program != null )
-            return false;
-        if ( status != that.status )
-            return false;
+        if ( attributes != null ? !attributes.equals( that.attributes ) : that.attributes != null ) return false;
+        if ( dateOfEnrollment != null ? !dateOfEnrollment.equals( that.dateOfEnrollment ) : that.dateOfEnrollment != null ) return false;
+        if ( dateOfIncident != null ? !dateOfIncident.equals( that.dateOfIncident ) : that.dateOfIncident != null ) return false;
+        if ( enrollment != null ? !enrollment.equals( that.enrollment ) : that.enrollment != null ) return false;
+        if ( person != null ? !person.equals( that.person ) : that.person != null ) return false;
+        if ( program != null ? !program.equals( that.program ) : that.program != null ) return false;
+        if ( status != that.status ) return false;
 
         return true;
     }
@@ -165,14 +174,21 @@
         result = 31 * result + (status != null ? status.hashCode() : 0);
         result = 31 * result + (dateOfEnrollment != null ? dateOfEnrollment.hashCode() : 0);
         result = 31 * result + (dateOfIncident != null ? dateOfIncident.hashCode() : 0);
+        result = 31 * result + (attributes != null ? attributes.hashCode() : 0);
         return result;
     }
 
     @Override
     public String toString()
     {
-        return "Enrollment{" + "enrollment='" + enrollment + '\'' + ", person='" + person + '\'' + ", program='"
-            + program + '\'' + ", status=" + status + ", dateOfEnrollment=" + dateOfEnrollment + ", dateOfIncident="
-            + dateOfIncident + '}';
+        return "Enrollment{" +
+            "enrollment='" + enrollment + '\'' +
+            ", person='" + person + '\'' +
+            ", program='" + program + '\'' +
+            ", status=" + status +
+            ", dateOfEnrollment=" + dateOfEnrollment +
+            ", dateOfIncident=" + dateOfIncident +
+            ", attributes=" + attributes +
+            '}';
     }
 }