dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #01446
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 447: Improved performance when opening preview screen.
------------------------------------------------------------
revno: 447
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Wed 2009-07-08 23:33:39 +0200
message:
Improved performance when opening preview screen.
modified:
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ImportDataValueService.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ImportDataValueStore.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/hibernate/HibernateImportDataValueStore.java
dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/service/DefaultImportDataValueService.java
dhis-2/dhis-services/dhis-service-importexport/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/imp/GetPreviewOptionsAction.java
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ImportDataValueService.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ImportDataValueService.java 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ImportDataValueService.java 2009-07-08 21:33:39 +0000
@@ -50,4 +50,6 @@
void deleteImportDataValuesByDataElement( int dataElementId );
void deleteImportDataValuesBySource( int sourceId );
+
+ int getNumberOfImportDataValues( ImportObjectStatus status );
}
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ImportDataValueStore.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ImportDataValueStore.java 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/ImportDataValueStore.java 2009-07-08 21:33:39 +0000
@@ -46,4 +46,6 @@
void deleteImportDataValuesByDataElement( int dataElementId );
void deleteImportDataValuesBySource( int sourceId );
+
+ int getNumberOfImportDataValues( ImportObjectStatus status );
}
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/hibernate/HibernateImportDataValueStore.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/hibernate/HibernateImportDataValueStore.java 2009-06-10 22:25:07 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/hibernate/HibernateImportDataValueStore.java 2009-07-08 21:33:39 +0000
@@ -37,6 +37,7 @@
import org.hisp.dhis.importexport.ImportDataValue;
import org.hisp.dhis.importexport.ImportDataValueStore;
import org.hisp.dhis.importexport.ImportObjectStatus;
+import org.springframework.jdbc.core.JdbcTemplate;
/**
* @author Lars Helge Overland
@@ -55,6 +56,13 @@
{
this.sessionFactory = sessionFactory;
}
+
+ private JdbcTemplate jdbcTemplate;
+
+ public void setJdbcTemplate( JdbcTemplate jdbcTemplate )
+ {
+ this.jdbcTemplate = jdbcTemplate;
+ }
// ----------------------------------------------------------------------
// ImportDataValueStore implementation
@@ -113,4 +121,11 @@
query.executeUpdate();
}
+
+ public int getNumberOfImportDataValues( ImportObjectStatus status )
+ {
+ String sql = "SELECT COUNT(*) FROM importdatavalue WHERE status = '" + status.name() + "'";
+
+ return jdbcTemplate.queryForInt( sql );
+ }
}
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/service/DefaultImportDataValueService.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/service/DefaultImportDataValueService.java 2009-06-10 22:25:07 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/service/DefaultImportDataValueService.java 2009-07-08 21:33:39 +0000
@@ -82,4 +82,9 @@
{
importDataValueStore.deleteImportDataValuesBySource( sourceId );
}
+
+ public int getNumberOfImportDataValues( ImportObjectStatus status )
+ {
+ return importDataValueStore.getNumberOfImportDataValues( status );
+ }
}
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/resources/META-INF/dhis/beans.xml 2009-06-14 19:43:19 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/resources/META-INF/dhis/beans.xml 2009-07-08 21:33:39 +0000
@@ -62,6 +62,7 @@
<bean id="org.hisp.dhis.importexport.ImportDataValueStore"
class="org.hisp.dhis.importexport.hibernate.HibernateImportDataValueStore">
<property name="sessionFactory" ref="sessionFactory"/>
+ <property name="jdbcTemplate" ref="jdbcTemplate"/>
</bean>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
=== modified file 'dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/imp/GetPreviewOptionsAction.java'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/imp/GetPreviewOptionsAction.java 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/imp/GetPreviewOptionsAction.java 2009-07-08 21:33:39 +0000
@@ -386,7 +386,7 @@
newValidationRules = importObjectService.getImportObjects( ImportObjectStatus.NEW, ValidationRule.class ).size();
newReportTables = importObjectService.getImportObjects( ImportObjectStatus.NEW, ReportTable.class ).size();
newOlapUrls = importObjectService.getImportObjects( ImportObjectStatus.NEW, OlapURL.class ).size();
- newDataValues = importDataValueService.getImportDataValues( ImportObjectStatus.NEW ).size();
+ newDataValues = importDataValueService.getNumberOfImportDataValues( ImportObjectStatus.NEW );
updateDataElements = importObjectService.getImportObjects( ImportObjectStatus.UPDATE, DataElement.class ).size();
updateCalculatedDataElements = importObjectService.getImportObjects( ImportObjectStatus.UPDATE, CalculatedDataElement.class ).size();
@@ -404,7 +404,7 @@
updateValidationRules = importObjectService.getImportObjects( ImportObjectStatus.UPDATE, ValidationRule.class ).size();
updateReportTables = importObjectService.getImportObjects( ImportObjectStatus.UPDATE, ReportTable.class ).size();
updateOlapUrls = importObjectService.getImportObjects( ImportObjectStatus.UPDATE, OlapURL.class ).size();
- updateDataValues = importDataValueService.getImportDataValues( ImportObjectStatus.UPDATE ).size();
+ updateDataValues = importDataValueService.getNumberOfImportDataValues( ImportObjectStatus.UPDATE );
// -------------------------------------------------------------------------
// Remember last type and status value
--
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.