← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22184: Temp fix to avoid circular dependency in DefaultTrackedEntityAttributeService

 

------------------------------------------------------------
revno: 22184
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2016-03-08 10:34:28 +0100
message:
  Temp fix to avoid circular dependency in DefaultTrackedEntityAttributeService
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityAttributeService.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-core/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityAttributeService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityAttributeService.java	2016-03-02 11:54:40 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/trackedentity/DefaultTrackedEntityAttributeService.java	2016-03-08 09:34:28 +0000
@@ -42,6 +42,7 @@
 import org.hisp.dhis.system.util.MathUtils;
 import org.hisp.dhis.user.UserService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.Assert;
 
@@ -83,11 +84,11 @@
     }
 
     @Autowired
-    private TrackedEntityInstanceService trackedEntityInstanceService;
-
-    @Autowired
     private UserService userService;
 
+    @Autowired
+    private ApplicationContext applicationContext;
+
     // -------------------------------------------------------------------------
     // Implementation methods
     // -------------------------------------------------------------------------
@@ -256,6 +257,10 @@
             params.setOrganisationUnitMode( OrganisationUnitSelectionMode.ALL );
         }
 
+        // TODO re-factor to avoid circular dependency
+        
+        TrackedEntityInstanceService trackedEntityInstanceService = (TrackedEntityInstanceService) applicationContext.getBean( TrackedEntityInstanceService.class );
+        
         Grid instances = trackedEntityInstanceService.getTrackedEntityInstancesGrid( params );
 
         if ( !(instances.getHeight() == 0) )