dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #02422
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 812: Reduced memory usage in the import of organisation unit relationships process.
------------------------------------------------------------
revno: 812
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Thu 2009-10-01 11:24:46 +0200
message:
Reduced memory usage in the import of organisation unit relationships process.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitStore.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/converter/AbstractOrganisationUnitRelationshipConverter.java
dhis-2/dhis-services/dhis-service-organisationunit/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java
dhis-2/dhis-services/dhis-service-organisationunit/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitStore.java
dhis-2/dhis-services/dhis-service-organisationunit/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DefaultDataEntryScreenManager.java
dhis-2/pom.xml
--
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-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java 2009-06-30 15:44:49 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java 2009-10-01 09:24:46 +0000
@@ -217,6 +217,8 @@
*/
int getNumberOfOrganisationalLevels();
+ void updateOrganisationUnitParent( int organisationUnitId, int parentId );
+
// -------------------------------------------------------------------------
// OrganisationUnitHierarchy
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitStore.java 2009-06-10 22:25:07 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitStore.java 2009-10-01 09:24:46 +0000
@@ -86,6 +86,8 @@
*/
Collection<OrganisationUnit> getRootOrganisationUnits();
+ void updateOrganisationUnitParent( int organisationUnitId, int parentId );
+
// -------------------------------------------------------------------------
// OrganisationUnitHierarchy
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/converter/AbstractOrganisationUnitRelationshipConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/converter/AbstractOrganisationUnitRelationshipConverter.java 2009-08-12 21:06:37 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/converter/AbstractOrganisationUnitRelationshipConverter.java 2009-10-01 09:24:46 +0000
@@ -49,15 +49,7 @@
protected void importUnique( GroupMemberAssociation object )
{
- OrganisationUnit child = organisationUnitService.getOrganisationUnit( object.getMemberId() );
-
- OrganisationUnit parent = new OrganisationUnit();
-
- parent.setId( object.getGroupId() );
-
- child.setParent( parent );
-
- organisationUnitBatchHandler.updateObject( child );
+ organisationUnitService.updateOrganisationUnitParent( object.getMemberId(), object.getGroupId() );
}
protected void importMatching( GroupMemberAssociation object, GroupMemberAssociation match )
=== modified file 'dhis-2/dhis-services/dhis-service-organisationunit/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java'
--- dhis-2/dhis-services/dhis-service-organisationunit/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java 2009-06-30 15:44:49 +0000
+++ dhis-2/dhis-services/dhis-service-organisationunit/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java 2009-10-01 09:24:46 +0000
@@ -398,6 +398,11 @@
return maxDepth;
}
+ public void updateOrganisationUnitParent( int organisationUnitId, int parentId )
+ {
+ organisationUnitStore.updateOrganisationUnitParent( organisationUnitId, parentId );
+ }
+
// -------------------------------------------------------------------------
// OrganisationUnitHierarchy
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-organisationunit/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitStore.java'
--- dhis-2/dhis-services/dhis-service-organisationunit/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitStore.java 2009-06-10 22:25:07 +0000
+++ dhis-2/dhis-services/dhis-service-organisationunit/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitStore.java 2009-10-01 09:24:46 +0000
@@ -35,6 +35,8 @@
import java.util.List;
import java.util.Map;
+import org.amplecode.quick.StatementHolder;
+import org.amplecode.quick.StatementManager;
import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.Session;
@@ -64,14 +66,21 @@
{
this.sessionFactory = sessionFactory;
}
-
+
+ private StatementManager statementManager;
+
+ public void setStatementManager( StatementManager statementManager )
+ {
+ this.statementManager = statementManager;
+ }
+
private SourceStore sourceStore;
public void setSourceStore( SourceStore sourceStore )
{
this.sourceStore = sourceStore;
}
-
+
// -------------------------------------------------------------------------
// OrganisationUnit
// -------------------------------------------------------------------------
@@ -282,6 +291,18 @@
}
}
+ public void updateOrganisationUnitParent( int organisationUnitId, int parentId )
+ {
+ StatementHolder holder = statementManager.getHolder();
+
+ final String sql =
+ "UPDATE organisationunit " +
+ "SET parentid='" + parentId + "' " +
+ "WHERE organisationunitid='" + organisationUnitId + "'";
+
+ holder.executeUpdate( sql );
+ }
+
// -------------------------------------------------------------------------
// OrganisationUnitLevel
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-organisationunit/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-organisationunit/src/main/resources/META-INF/dhis/beans.xml 2009-09-14 17:26:26 +0000
+++ dhis-2/dhis-services/dhis-service-organisationunit/src/main/resources/META-INF/dhis/beans.xml 2009-10-01 09:24:46 +0000
@@ -9,6 +9,7 @@
<bean id="org.hisp.dhis.organisationunit.OrganisationUnitStore"
class="org.hisp.dhis.organisationunit.hibernate.HibernateOrganisationUnitStore">
<property name="sessionFactory" ref="sessionFactory"/>
+ <property name="statementManager" ref="statementManager"/>
<property name="sourceStore"
ref="org.hisp.dhis.source.SourceStore"/>
</bean>
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DefaultDataEntryScreenManager.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DefaultDataEntryScreenManager.java 2009-09-28 16:16:47 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DefaultDataEntryScreenManager.java 2009-10-01 09:24:46 +0000
@@ -308,7 +308,7 @@
// Iterate through all matching data element fields
// ---------------------------------------------------------------------
- Map<Integer, DataElement> dataElementMap = getDataElementMap( dataSet );
+ //Map<Integer, DataElement> dataElementMap = getDataElementMap( dataSet );
while ( dataElementMatcher.find() )
{
@@ -329,7 +329,7 @@
int dataElementId = Integer.parseInt( identifierMatcher.group( 1 ) );
int optionComboId = Integer.parseInt( identifierMatcher.group( 2 ) );
- DataElement dataElement = dataElementMap.get( dataElementId ); //dataElementService.getDataElement( dataElementId );
+ DataElement dataElement = dataElementService.getDataElement( dataElementId ); //dataElementMap.get( dataElementId ); // //TODO change
// -------------------------------------------------------------
// Find type of data element
=== modified file 'dhis-2/pom.xml'
--- dhis-2/pom.xml 2009-09-28 17:36:03 +0000
+++ dhis-2/pom.xml 2009-10-01 09:24:46 +0000
@@ -24,7 +24,6 @@
<module>dhis-useradminandsecurity</module>
</modules>
- <!--
<repositories>
<repository>
<id>amplecode_maven2_repo</id>
@@ -32,7 +31,6 @@
<url>http://www.amplecode.org/maven2</url>
</repository>
</repositories>
- -->
<!--
<pluginRepositories>
@@ -291,7 +289,7 @@
<dependency>
<groupId>org.amplecode</groupId>
<artifactId>quick</artifactId>
- <version>1.1</version>
+ <version>1.1.2</version>
</dependency>
<dependency>
<groupId>com.lowagie</groupId>