← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15623: minor fix to Relationship class

 

------------------------------------------------------------
revno: 15623
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-06-11 14:43:09 +0200
message:
  minor fix to Relationship class
modified:
  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/Relationship.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/trackedentity/AbstractTrackedEntityInstanceService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/AbstractTrackedEntityInstanceService.java	2014-05-17 12:04:42 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/AbstractTrackedEntityInstanceService.java	2014-06-11 12:43:09 +0000
@@ -127,7 +127,7 @@
             org.hisp.dhis.dxf2.events.trackedentity.Relationship relationship = new org.hisp.dhis.dxf2.events.trackedentity.Relationship();
             relationship.setDisplayName( entityRelationship.getRelationshipType().getDisplayName() );
             relationship.setTrackedEntityInstance( entityRelationship.getEntityInstanceA().getUid() );
-            relationship.setType( entityRelationship.getRelationshipType().getUid() );
+            relationship.setRelationship( entityRelationship.getRelationshipType().getUid() );
 
             trackedEntityInstance.getRelationships().add( relationship );
         }
@@ -370,12 +370,12 @@
 
         for ( org.hisp.dhis.dxf2.events.trackedentity.Relationship relationship : trackedEntityInstance.getRelationships() )
         {
-            RelationshipType relationshipType = manager.get( RelationshipType.class, relationship.getType() );
+            RelationshipType relationshipType = manager.get( RelationshipType.class, relationship.getRelationship() );
 
             if ( relationshipType == null )
             {
                 importConflicts.add( new ImportConflict( "Relationship.type", "Invalid type "
-                    + relationship.getType() ) );
+                    + relationship.getRelationship() ) );
             }
 
             org.hisp.dhis.trackedentity.TrackedEntityInstance entityInstance = manager.get( org.hisp.dhis.trackedentity.TrackedEntityInstance.class, relationship.getTrackedEntityInstance() );
@@ -414,7 +414,7 @@
         for ( org.hisp.dhis.dxf2.events.trackedentity.Relationship relationship : trackedEntityInstance.getRelationships() )
         {
             org.hisp.dhis.trackedentity.TrackedEntityInstance entityInstanceB = manager.get( org.hisp.dhis.trackedentity.TrackedEntityInstance.class, relationship.getTrackedEntityInstance() );
-            RelationshipType relationshipType = manager.get( RelationshipType.class, relationship.getType() );
+            RelationshipType relationshipType = manager.get( RelationshipType.class, relationship.getRelationship() );
 
             Relationship entityRelationship = new Relationship();
             entityRelationship.setEntityInstanceA( entityInstance );

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/Relationship.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/Relationship.java	2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/Relationship.java	2014-06-11 12:43:09 +0000
@@ -36,21 +36,21 @@
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */
-@JacksonXmlRootElement( localName = "relationship", namespace = DxfNamespaces.DXF_2_0 )
+@JacksonXmlRootElement(localName = "relationship", namespace = DxfNamespaces.DXF_2_0)
 public class Relationship
 {
     private String displayName;
 
     private String trackedEntityInstance;
 
-    private String type;
+    private String relationship;
 
     public Relationship()
     {
     }
 
     @JsonProperty
-    @JacksonXmlProperty( isAttribute = true )
+    @JacksonXmlProperty(isAttribute = true)
     public String getDisplayName()
     {
         return displayName;
@@ -62,7 +62,7 @@
     }
 
     @JsonProperty
-    @JacksonXmlProperty( isAttribute = true )
+    @JacksonXmlProperty(isAttribute = true)
     public String getTrackedEntityInstance()
     {
         return trackedEntityInstance;
@@ -75,14 +75,14 @@
 
     @JsonProperty
     @JacksonXmlProperty( isAttribute = true )
-    public String getType()
+    public String getRelationship()
     {
-        return type;
+        return relationship;
     }
 
-    public void setType( String type )
+    public void setRelationship( String relationship )
     {
-        this.type = type;
+        this.relationship = relationship;
     }
 
     @Override
@@ -96,7 +96,7 @@
         if ( displayName != null ? !displayName.equals( that.displayName ) : that.displayName != null ) return false;
         if ( trackedEntityInstance != null ? !trackedEntityInstance.equals( that.trackedEntityInstance ) : that.trackedEntityInstance != null )
             return false;
-        if ( type != null ? !type.equals( that.type ) : that.type != null ) return false;
+        if ( relationship != null ? !relationship.equals( that.relationship ) : that.relationship != null ) return false;
 
         return true;
     }
@@ -106,7 +106,7 @@
     {
         int result = displayName != null ? displayName.hashCode() : 0;
         result = 31 * result + (trackedEntityInstance != null ? trackedEntityInstance.hashCode() : 0);
-        result = 31 * result + (type != null ? type.hashCode() : 0);
+        result = 31 * result + (relationship != null ? relationship.hashCode() : 0);
         return result;
     }
 
@@ -116,7 +116,7 @@
         return "Relationship{" +
             "displayName='" + displayName + '\'' +
             ", trackedEntityInstance='" + trackedEntityInstance + '\'' +
-            ", type='" + type + '\'' +
+            ", relationship='" + relationship + '\'' +
             '}';
     }
 }