dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #34327
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17617: importer, build up dynamic cache for preheat=false
------------------------------------------------------------
revno: 17617
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2014-11-29 19:20:13 +0700
message:
importer, build up dynamic cache for preheat=false
modified:
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.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/metadata/DefaultObjectBridge.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java 2014-11-11 06:54:03 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java 2014-11-29 12:20:13 +0000
@@ -30,26 +30,24 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.common.IdentifiableObjectManager;
import org.hisp.dhis.common.IdentifiableProperty;
-import org.hisp.dhis.system.timer.SystemTimer;
-import org.hisp.dhis.system.timer.Timer;
import org.hisp.dhis.period.PeriodStore;
import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.schema.Schema;
import org.hisp.dhis.schema.SchemaService;
import org.hisp.dhis.system.deletion.DeletionManager;
+import org.hisp.dhis.system.timer.SystemTimer;
+import org.hisp.dhis.system.timer.Timer;
import org.hisp.dhis.user.User;
import org.hisp.dhis.user.UserCredentials;
import org.hisp.dhis.user.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.PostConstruct;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -570,10 +568,20 @@
{
entity = map.get( identifiableObject.getUid() );
}
+ else
+ {
+ uidMap.put( identifiableObject.getClass(), new HashMap<String, IdentifiableObject>() );
+ map = uidMap.get( identifiableObject.getClass() );
+ }
if ( !preheatCache && entity == null )
{
entity = manager.get( identifiableObject.getClass(), identifiableObject.getUid() );
+
+ if ( entity != null )
+ {
+ map.put( entity.getUid(), entity );
+ }
}
return entity;
@@ -588,10 +596,20 @@
{
entity = map.get( identifiableObject.getCode() );
}
+ else
+ {
+ codeMap.put( identifiableObject.getClass(), new HashMap<String, IdentifiableObject>() );
+ map = codeMap.get( identifiableObject.getClass() );
+ }
if ( !preheatCache && entity == null )
{
entity = manager.getByCode( identifiableObject.getClass(), identifiableObject.getCode() );
+
+ if ( entity != null )
+ {
+ map.put( entity.getCode(), entity );
+ }
}
return entity;
@@ -606,10 +624,20 @@
{
entity = map.get( identifiableObject.getName() );
}
+ else
+ {
+ nameMap.put( identifiableObject.getClass(), new HashMap<String, IdentifiableObject>() );
+ map = nameMap.get( identifiableObject.getClass() );
+ }
if ( !preheatCache && identifiableObject.haveUniqueNames() && entity == null )
{
entity = manager.getByName( identifiableObject.getClass(), identifiableObject.getName() );
+
+ if ( entity != null )
+ {
+ map.put( entity.getName(), entity );
+ }
}
return entity;