dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #35901
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18383: Data import, reusing callable to reduce heap usage during import
------------------------------------------------------------
revno: 18383
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-02-24 11:39:18 +0100
message:
Data import, reusing callable to reduce heap usage during import
modified:
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java
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-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java 2015-02-20 13:45:23 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java 2015-02-24 10:39:18 +0000
@@ -641,6 +641,11 @@
orgUnitMap.putAll( getOrgUnitMap( orgUnitIdScheme ) );
}
+ IdentifiableObjectCallable<DataElement> dataElementCallable = new IdentifiableObjectCallable<>(
+ identifiableObjectManager, DataElement.class, null );
+ IdentifiableObjectCallable<OrganisationUnit> orgUnitCallable = new IdentifiableObjectCallable<>(
+ identifiableObjectManager, OrganisationUnit.class, trimToNull( dataValueSet.getOrgUnit() ) );
+
//----------------------------------------------------------------------
// Get outer meta-data
//----------------------------------------------------------------------
@@ -651,8 +656,7 @@
Period outerPeriod = PeriodType.getPeriodFromIsoString( trimToNull( dataValueSet.getPeriod() ) );
- OrganisationUnit outerOrgUnit = orgUnitMap.get( trimToNull( dataValueSet.getOrgUnit() ),
- new IdentifiableObjectCallable<>( identifiableObjectManager, OrganisationUnit.class, trimToNull( dataValueSet.getOrgUnit() ) ) );
+ OrganisationUnit outerOrgUnit = orgUnitMap.get( trimToNull( dataValueSet.getOrgUnit() ), orgUnitCallable );
DataElementCategoryOptionCombo fallbackCategoryOptionCombo = categoryService.getDefaultDataElementCategoryOptionCombo();
@@ -724,11 +728,10 @@
totalCount++;
- DataElement dataElement = dataElementMap.get( trimToNull( dataValue.getDataElement() ),
- new IdentifiableObjectCallable<>( identifiableObjectManager, DataElement.class, trimToNull( dataValue.getDataElement() ) ) );
+ DataElement dataElement = dataElementMap.get( trimToNull( dataValue.getDataElement() ), dataElementCallable.setUid( trimToNull( dataValue.getDataElement() ) ) );
Period period = outerPeriod != null ? outerPeriod : PeriodType.getPeriodFromIsoString( trimToNull( dataValue.getPeriod() ) );
- OrganisationUnit orgUnit = outerOrgUnit != null ? outerOrgUnit : orgUnitMap.get( trimToNull( dataValue.getOrgUnit() ),
- new IdentifiableObjectCallable<>( identifiableObjectManager, OrganisationUnit.class, trimToNull( dataValue.getOrgUnit() ) ) );
+ OrganisationUnit orgUnit = outerOrgUnit != null ? outerOrgUnit :
+ orgUnitMap.get( trimToNull( dataValue.getOrgUnit() ), orgUnitCallable.setUid( trimToNull( dataValue.getOrgUnit() ) ) );
DataElementCategoryOptionCombo categoryOptionCombo = categoryOptionComboMap.get( trimToNull( dataValue.getCategoryOptionCombo() ) );
DataElementCategoryOptionCombo attrOptionCombo = outerAttrOptionCombo != null ? outerAttrOptionCombo :
categoryOptionComboMap.get( trimToNull( dataValue.getAttributeOptionCombo() ) );
=== 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-19 23:24:21 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/callable/IdentifiableObjectCallable.java 2015-02-24 10:39:18 +0000
@@ -57,4 +57,10 @@
{
return manager.get( clazz, uid );
}
+
+ public IdentifiableObjectCallable<T> setUid( String uid )
+ {
+ this.uid = uid;
+ return this;
+ }
}