dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #24820
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12221: Moved some resourcetable code to ResourceTableTask
------------------------------------------------------------
revno: 12221
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-09-24 09:41:09 +0200
message:
Moved some resourcetable code to ResourceTableTask
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/resourcetable/ResourceTableService.java
dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java
dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/scheduling/ResourceTableTask.java
dhis-2/dhis-services/dhis-service-administration/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ResourceTableController.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-api/src/main/java/org/hisp/dhis/resourcetable/ResourceTableService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/resourcetable/ResourceTableService.java 2013-09-24 07:05:03 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/resourcetable/ResourceTableService.java 2013-09-24 07:41:09 +0000
@@ -36,11 +36,6 @@
String ID = ResourceTableService.class.getName();
/**
- * Generates all resource tables.
- */
- void generateAll();
-
- /**
* Generates a resource table containing the hierarchy graph for each
* OrganisationUnit.
*/
=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java 2013-09-24 07:18:23 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java 2013-09-24 07:41:09 +0000
@@ -72,7 +72,6 @@
import org.hisp.dhis.resourcetable.statement.CreateDataElementGroupSetTableStatement;
import org.hisp.dhis.resourcetable.statement.CreateIndicatorGroupSetTableStatement;
import org.hisp.dhis.resourcetable.statement.CreateOrganisationUnitGroupSetTableStatement;
-import org.hisp.dhis.sqlview.SqlViewService;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
@@ -137,55 +136,6 @@
this.periodService = periodService;
}
- private SqlViewService sqlViewService;
-
- public void setSqlViewService( SqlViewService sqlViewService )
- {
- this.sqlViewService = sqlViewService;
- }
-
- // -------------------------------------------------------------------------
- // All
- // -------------------------------------------------------------------------
-
- public void generateAll()
- {
- sqlViewService.dropAllSqlViewTables();
-
- generateOrganisationUnitStructures();
- log.info( "Organisation unit structure table generated" );
-
- generateCategoryOptionComboNames();
- log.info( "Category option combo name table generated" );
-
- generateDataElementGroupSetTable();
- log.info( "Data element group set table generated" );
-
- generateIndicatorGroupSetTable();
- log.info( "Indicator group set table generated" );
-
- generateOrganisationUnitGroupSetTable();
- log.info( "Organisation unit group set table generated" );
-
- generateCategoryTable();
- log.info( "Category table generated" );
-
- generateDataElementTable();
- log.info( "Data element table generated" );
-
- generatePeriodTable();
- log.info( "Period table generated" );
-
- generateDatePeriodTable();
- log.info( "Date period table generated" );
-
- generateDataElementCategoryOptionComboTable();
- log.info( "Data element category option combo table generated" );
-
- sqlViewService.createAllViewTables();
- log.info( "Sql views created" );
- }
-
// -------------------------------------------------------------------------
// OrganisationUnitStructure
// -------------------------------------------------------------------------
@@ -234,6 +184,8 @@
}
resourceTableStore.batchUpdate( ( maxLevel * 2 ) + 2, TABLE_NAME_ORGANISATION_UNIT_STRUCTURE, batchArgs );
+
+ log.info( "Organisation unit structure table generated" );
}
// -------------------------------------------------------------------------
@@ -263,6 +215,8 @@
}
resourceTableStore.batchUpdate( 2, TABLE_NAME_CATEGORY_OPTION_COMBO_NAME, batchArgs );
+
+ log.info( "Category option combo name table generated" );
}
// -------------------------------------------------------------------------
@@ -311,6 +265,8 @@
}
resourceTableStore.batchUpdate( ( groupSets.size() * 2 ) + 2, CreateDataElementGroupSetTableStatement.TABLE_NAME, batchArgs );
+
+ log.info( "Data element group set table generated" );
}
// -------------------------------------------------------------------------
@@ -359,6 +315,8 @@
}
resourceTableStore.batchUpdate( ( groupSets.size() * 2 ) + 2, CreateIndicatorGroupSetTableStatement.TABLE_NAME, batchArgs );
+
+ log.info( "Indicator group set table generated" );
}
// -------------------------------------------------------------------------
@@ -409,6 +367,8 @@
}
resourceTableStore.batchUpdate( ( groupSets.size() * 2 ) + 2, CreateOrganisationUnitGroupSetTableStatement.TABLE_NAME, batchArgs );
+
+ log.info( "Organisation unit group set table generated" );
}
// -------------------------------------------------------------------------
@@ -456,6 +416,8 @@
}
resourceTableStore.batchUpdate( ( categories.size() * 2 ) + 2, CreateCategoryTableStatement.TABLE_NAME, batchArgs );
+
+ log.info( "Category table generated" );
}
// -------------------------------------------------------------------------
@@ -494,6 +456,8 @@
}
resourceTableStore.batchUpdate( 4, TABLE_NAME_DATA_ELEMENT_STRUCTURE, batchArgs );
+
+ log.info( "Data element table generated" );
}
// -------------------------------------------------------------------------
@@ -541,6 +505,8 @@
}
resourceTableStore.batchUpdate( PeriodType.PERIOD_TYPES.size() + 1, TABLE_NAME_DATE_PERIOD_STRUCTURE, batchArgs );
+
+ log.info( "Period table generated" );
}
@Transactional
@@ -587,6 +553,8 @@
}
resourceTableStore.batchUpdate( PeriodType.PERIOD_TYPES.size() + 3, TABLE_NAME_PERIOD_STRUCTURE, batchArgs );
+
+ log.info( "Date period table generated" );
}
// -------------------------------------------------------------------------
@@ -597,5 +565,7 @@
public void generateDataElementCategoryOptionComboTable()
{
resourceTableStore.createAndGenerateDataElementCategoryOptionCombo();
+
+ log.info( "Data element category option combo table generated" );
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/scheduling/ResourceTableTask.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/scheduling/ResourceTableTask.java 2013-09-04 07:35:34 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/scheduling/ResourceTableTask.java 2013-09-24 07:41:09 +0000
@@ -31,6 +31,7 @@
import org.hisp.dhis.message.MessageService;
import org.hisp.dhis.resourcetable.ResourceTableService;
import org.hisp.dhis.scheduling.TaskId;
+import org.hisp.dhis.sqlview.SqlViewService;
import org.hisp.dhis.system.notification.NotificationLevel;
import org.hisp.dhis.system.notification.Notifier;
import org.springframework.beans.factory.annotation.Autowired;
@@ -43,6 +44,9 @@
{
@Autowired
private ResourceTableService resourceTableService;
+
+ @Autowired
+ private SqlViewService sqlViewService;
@Autowired
private Notifier notifier;
@@ -68,7 +72,7 @@
try
{
- resourceTableService.generateAll();
+ generateAll();
notifier.notify( taskId, NotificationLevel.INFO, "Resource tables generated", true );
}
@@ -80,5 +84,25 @@
throw ex;
}
+ }
+
+ // -------------------------------------------------------------------------
+ // Supportive methods
+ // -------------------------------------------------------------------------
+
+ private void generateAll()
+ {
+ sqlViewService.dropAllSqlViewTables();
+ resourceTableService.generateOrganisationUnitStructures();
+ resourceTableService.generateCategoryOptionComboNames();
+ resourceTableService.generateDataElementGroupSetTable();
+ resourceTableService.generateIndicatorGroupSetTable();
+ resourceTableService.generateOrganisationUnitGroupSetTable();
+ resourceTableService.generateCategoryTable();
+ resourceTableService.generateDataElementTable();
+ resourceTableService.generatePeriodTable();
+ resourceTableService.generateDatePeriodTable();
+ resourceTableService.generateDataElementCategoryOptionComboTable();
+ sqlViewService.createAllViewTables();
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-administration/src/main/resources/META-INF/dhis/beans.xml 2013-09-11 16:52:21 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/resources/META-INF/dhis/beans.xml 2013-09-24 07:41:09 +0000
@@ -17,7 +17,6 @@
<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
<property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
<property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
- <property name="sqlViewService" ref="org.hisp.dhis.sqlview.SqlViewService" />
</bean>
<!-- Data integrity -->
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ResourceTableController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ResourceTableController.java 2013-09-13 11:22:35 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ResourceTableController.java 2013-09-24 07:41:09 +0000
@@ -102,5 +102,5 @@
scheduler.executeTask( resourceTableTask );
ContextUtils.okResponse( response, "Initiated resource table update" );
- }
+ }
}