← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15630: minor bugfix for relationship, correctly set pointer in export

 

------------------------------------------------------------
revno: 15630
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-06-11 17:01:05 +0200
message:
  minor bugfix for relationship, correctly set pointer in export
modified:
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/AbstractTrackedEntityInstanceService.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/event/AbstractEventService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java	2014-06-11 13:32:50 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/event/AbstractEventService.java	2014-06-11 15:01:05 +0000
@@ -541,12 +541,15 @@
         if ( comment != null )
         {
             Note note = new Note();
+
             note.setValue( comment.getCommentText() );
             note.setStoredBy( comment.getCreator() );
+
             if ( comment.getCreatedDate() != null )
             {
                 note.setStoredDate( comment.getCreatedDate().toString() );
             }
+
             event.getNotes().add( note );
         }
 

=== 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-06-11 12:57:50 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/AbstractTrackedEntityInstanceService.java	2014-06-11 15:01:05 +0000
@@ -29,7 +29,6 @@
  */
 
 import com.google.common.collect.Lists;
-
 import org.hisp.dhis.common.Grid;
 import org.hisp.dhis.common.IdentifiableObjectManager;
 import org.hisp.dhis.common.OrganisationUnitSelectionMode;
@@ -126,7 +125,16 @@
         {
             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() );
+
+            if ( entityInstance.getUid().equals( entityRelationship.getEntityInstanceA().getUid() ) )
+            {
+                relationship.setTrackedEntityInstance( entityRelationship.getEntityInstanceB().getUid() );
+            }
+            else
+            {
+                relationship.setTrackedEntityInstance( entityRelationship.getEntityInstanceA().getUid() );
+            }
+
             relationship.setRelationship( entityRelationship.getRelationshipType().getUid() );
 
             trackedEntityInstance.getRelationships().add( relationship );