=== 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 2009-05-13 15:51:02 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/resourcetable/ResourceTableService.java 2010-01-12 08:12:04 +0000
@@ -54,7 +54,17 @@
void generateCategoryOptionComboNames();
/**
+ * Generates a resource table for all data elements.
+ */
+ void generateDataElementGroupSetTable();
+
+ /**
+ * Generates a resource table for all indicators.
+ */
+ void generateIndicatorGroupSetTable();
+
+ /**
* Generates a resource table for all organisation units
*/
- void generateExclusiveGroupSetStructures();
+ void generateOrganisationUnitGroupSetTable();
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/resourcetable/ResourceTableStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/resourcetable/ResourceTableStore.java 2009-06-14 19:43:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/resourcetable/ResourceTableStore.java 2010-01-12 08:12:04 +0000
@@ -1,6 +1,11 @@
package org.hisp.dhis.resourcetable;
import java.util.Collection;
+import java.util.List;
+
+import org.hisp.dhis.dataelement.DataElementGroupSet;
+import org.hisp.dhis.indicator.IndicatorGroupSet;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
public interface ResourceTableStore
{
@@ -85,18 +90,28 @@
int deleteDataElementCategoryOptionComboNames();
// -------------------------------------------------------------------------
- // ExclusiveGroupSetStructure
+ // GroupSetStructure
// -------------------------------------------------------------------------
/**
* Creates table.
*
- * @param statement the Statement.
- */
- void createExclusiveGroupSetStructureTable( String statement );
-
- /**
- * Removes table.
- */
- void removeExclusiveGroupSetStructureTable();
+ * @param groupSets the group sets.
+ */
+ void createDataElementGroupSetStructure( List groupSets );
+
+ /**
+ * Creates table.
+ *
+ * @param groupSets the group sets.
+ */
+ void createIndicatorGroupSetStructure( List groupSets );
+
+ /**
+ * Creates table.
+ *
+ * @param groupSets the group sets.
+ */
+ void createOrganisationUnitGroupSetStructure( List groupSets );
+
}
=== 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 2009-11-30 15:32:55 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java 2010-01-12 08:12:04 +0000
@@ -39,8 +39,20 @@
import org.amplecode.quick.Statement;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.dataelement.DataElementGroupSet;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.dataelement.comparator.DataElementGroupSetNameComparator;
+import org.hisp.dhis.dataelement.comparator.DataElementNameComparator;
+import org.hisp.dhis.dimension.Dimension;
+import org.hisp.dhis.dimension.DimensionOption;
+import org.hisp.dhis.indicator.Indicator;
+import org.hisp.dhis.indicator.IndicatorGroupSet;
+import org.hisp.dhis.indicator.IndicatorService;
+import org.hisp.dhis.indicator.comparator.IndicatorGroupSetNameComparator;
+import org.hisp.dhis.indicator.comparator.IndicatorNameComparator;
import org.hisp.dhis.jdbc.batchhandler.GenericBatchHandler;
import org.hisp.dhis.jdbc.batchhandler.GroupSetStructureBatchHandler;
import org.hisp.dhis.jdbc.batchhandler.OrganisationUnitStructureBatchHandler;
@@ -51,7 +63,9 @@
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.organisationunit.comparator.OrganisationUnitGroupSetNameComparator;
import org.hisp.dhis.organisationunit.comparator.OrganisationUnitNameComparator;
-import org.hisp.dhis.resourcetable.statement.CreateExclusiveGroupSetTableStatement;
+import org.hisp.dhis.resourcetable.statement.CreateDataElementGroupSetTableStatement;
+import org.hisp.dhis.resourcetable.statement.CreateIndicatorGroupSetTableStatement;
+import org.hisp.dhis.resourcetable.statement.CreateOrganisationUnitGroupSetTableStatement;
import org.springframework.transaction.annotation.Transactional;
/**
@@ -95,6 +109,20 @@
{
this.categoryService = categoryService;
}
+
+ private DataElementService dataElementService;
+
+ public void setDataElementService( DataElementService dataElementService )
+ {
+ this.dataElementService = dataElementService;
+ }
+
+ private IndicatorService indicatorService;
+
+ public void setIndicatorService( IndicatorService indicatorService )
+ {
+ this.indicatorService = indicatorService;
+ }
private BatchHandlerFactory batchHandlerFactory;
@@ -232,17 +260,111 @@
}
// -------------------------------------------------------------------------
- // Exclusive GroupSetStructure
- // -------------------------------------------------------------------------
-
- public void generateExclusiveGroupSetStructures()
- {
- // ---------------------------------------------------------------------
- // Drop table
- // ---------------------------------------------------------------------
-
- resourceTableStore.removeExclusiveGroupSetStructureTable();
-
+ // DataElementGroupSetTable
+ // -------------------------------------------------------------------------
+
+ public void generateDataElementGroupSetTable()
+ {
+ // ---------------------------------------------------------------------
+ // Create table
+ // ---------------------------------------------------------------------
+
+ List dataElements = new ArrayList( dataElementService.getAllDataElements() );
+
+ Collections.sort( dataElements, new DataElementNameComparator() );
+
+ List groupSets = new ArrayList( dataElementService.getAllDataElementGroupSets() );
+
+ Collections.sort( groupSets, new DataElementGroupSetNameComparator() );
+
+ resourceTableStore.createDataElementGroupSetStructure( groupSets );
+
+ // ---------------------------------------------------------------------
+ // Populate table
+ // ---------------------------------------------------------------------
+
+ BatchHandler
-
-
+
+
+
+
+
+
+
+
+
+
+
+