← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18463: IdentifiableObjectCallable, added new constructor for IdentifiableProperty

 

------------------------------------------------------------
revno: 18463
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-03-03 10:13:20 +0100
message:
  IdentifiableObjectCallable, added new constructor for IdentifiableProperty
modified:
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/callable/IdentifiableObjectCallable.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-support/dhis-support-system/src/main/java/org/hisp/dhis/system/callable/IdentifiableObjectCallable.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/callable/IdentifiableObjectCallable.java	2015-02-24 10:39:18 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/callable/IdentifiableObjectCallable.java	2015-03-03 09:13:20 +0000
@@ -33,6 +33,7 @@
 
 import org.hisp.dhis.common.IdentifiableObject;
 import org.hisp.dhis.common.IdentifiableObjectManager;
+import org.hisp.dhis.common.IdentifiableProperty;
 
 /**
  * @author Lars Helge Overland
@@ -42,6 +43,7 @@
 {
     private IdentifiableObjectManager manager;
     private Class<T> clazz;
+    private IdentifiableProperty property;
     private String uid;
     
     public IdentifiableObjectCallable( IdentifiableObjectManager manager, Class<T> clazz, String uid )
@@ -50,12 +52,27 @@
         this.clazz = clazz;
         this.uid = uid;
     }
+
+    public IdentifiableObjectCallable( IdentifiableObjectManager manager, Class<T> clazz, IdentifiableProperty property, String uid )
+    {
+        this.manager = manager;
+        this.clazz = clazz;
+        this.property = property;
+        this.uid = uid;
+    }
     
     @Override
     public T call()
         throws ExecutionException
     {
-        return manager.get( clazz, uid );
+        if ( property == null )
+        {
+            return manager.get( clazz, uid );
+        }
+        else
+        {
+            return manager.getObject( clazz, property, uid );
+        }
     }
     
     public IdentifiableObjectCallable<T> setUid( String uid )