← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6694: Minor fixes to identifiableObjectManager.

 

------------------------------------------------------------
revno: 6694
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-04-23 11:38:35 +0300
message:
  Minor fixes to identifiableObjectManager.
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.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/common/DefaultIdentifiableObjectManager.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java	2012-04-22 18:21:40 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java	2012-04-23 08:38:35 +0000
@@ -77,18 +77,45 @@
     @Override
     public void save( IdentifiableObject object )
     {
-        if ( objectStoreMap.get( object.getClass() ) != null )
-        {
-            objectStoreMap.get( object.getClass() ).save( object );
+        GenericIdentifiableObjectStore<IdentifiableObject> store = objectStoreMap.get( object.getClass() );
+
+        if ( store != null )
+        {
+            store.save( object );
+        }
+        else
+        {
+            log.warn( "No IdentifiableObject store found for " + object.getClass() + " (save)." );
         }
     }
 
     @Override
     public void update( IdentifiableObject object )
     {
-        if ( objectStoreMap.get( object.getClass() ) != null )
-        {
-            objectStoreMap.get( object.getClass() ).update( object );
+        GenericIdentifiableObjectStore<IdentifiableObject> store = objectStoreMap.get( object.getClass() );
+
+        if ( store != null )
+        {
+            store.update( object );
+        }
+        else
+        {
+            log.warn( "No IdentifiableObject store found for " + object.getClass() + " (update)." );
+        }
+    }
+
+    @Override
+    public void delete( IdentifiableObject object )
+    {
+        GenericIdentifiableObjectStore<IdentifiableObject> store = objectStoreMap.get( object.getClass() );
+
+        if ( store != null )
+        {
+            store.delete( object );
+        }
+        else
+        {
+            log.warn( "No IdentifiableObject store found for " + object.getClass() + " (delete)." );
         }
     }
 
@@ -116,7 +143,7 @@
 
         if ( store == null )
         {
-            log.warn( "No IdentifiableObject store found for " + clazz + ", returning null." );
+            log.warn( "No IdentifiableObject store found for " + clazz + ", returning null (getByCode)." );
 
             return null;
         }
@@ -132,7 +159,7 @@
 
         if ( store == null )
         {
-            log.warn( "No IdentifiableObject store found for " + clazz + ", returning null." );
+            log.warn( "No IdentifiableObject store found for " + clazz + ", returning null (getByName)." );
 
             return null;
         }
@@ -148,7 +175,7 @@
 
         if ( store == null )
         {
-            log.warn( "No IdentifiableObject store found for " + clazz + ", returning empty collection." );
+            log.warn( "No IdentifiableObject store found for " + clazz + ", returning empty collection (getAll)." );
 
             return new ArrayList<T>();
         }
@@ -156,11 +183,6 @@
         return (Collection<T>) store.getAll();
     }
 
-    public void delete( IdentifiableObject object )
-    {
-        objectStoreMap.get( object.getClass() ).delete( object );
-    }
-
     @Override
     @SuppressWarnings( "unchecked" )
     public <T extends IdentifiableObject> Map<String, T> getIdMap( Class<T> clazz, IdentifiableProperty property )