← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20381: Minor fix

 

------------------------------------------------------------
revno: 20381
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-09-28 10:22:02 +0700
message:
  Minor fix
modified:
  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/trackedentity/AbstractTrackedEntityInstanceService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/AbstractTrackedEntityInstanceService.java	2015-09-13 21:54:23 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/trackedentity/AbstractTrackedEntityInstanceService.java	2015-09-28 03:22:02 +0000
@@ -98,11 +98,11 @@
     @Autowired
     protected DbmsManager dbmsManager;
 
-    private CachingMap<String, OrganisationUnit> organisationUnitCache = new CachingMap<>();
-
-    private CachingMap<String, TrackedEntity> trackedEntityCache = new CachingMap<>();
-
-    private CachingMap<String, TrackedEntityAttribute> trackedEntityAttributeCache = new CachingMap<>();
+    private final CachingMap<String, OrganisationUnit> organisationUnitCache = new CachingMap<>();
+
+    private final CachingMap<String, TrackedEntity> trackedEntityCache = new CachingMap<>();
+
+    private final CachingMap<String, TrackedEntityAttribute> trackedEntityAttributeCache = new CachingMap<>();
 
     // -------------------------------------------------------------------------
     // READ
@@ -525,22 +525,13 @@
 
     private void removeRelationships( org.hisp.dhis.trackedentity.TrackedEntityInstance entityInstance )
     {
-        Collection<Relationship> relationships = relationshipService
-            .getRelationshipsForTrackedEntityInstance( entityInstance );
-
-        for ( Relationship relationship : relationships )
-        {
-            relationshipService.deleteRelationship( relationship );
-        }
+        Collection<Relationship> relationships = relationshipService.getRelationshipsForTrackedEntityInstance( entityInstance );
+        relationships.forEach( relationshipService::deleteRelationship );
     }
 
     private void removeAttributeValues( org.hisp.dhis.trackedentity.TrackedEntityInstance entityInstance )
     {
-        for ( TrackedEntityAttributeValue trackedEntityAttributeValue : entityInstance.getAttributeValues() )
-        {
-            attributeValueService.deleteTrackedEntityAttributeValue( trackedEntityAttributeValue );
-        }
-
+        entityInstance.getAttributeValues().forEach( attributeValueService::deleteTrackedEntityAttributeValue );
         teiService.updateTrackedEntityInstance( entityInstance );
     }