dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #22720
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11012: Added resource table _dataelementcategoryoptioncombo which holds data elements and relevant optio...
------------------------------------------------------------
revno: 11012
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-05-27 13:07:26 +0200
message:
Added resource table _dataelementcategoryoptioncombo which holds data elements and relevant option combos. Using it to improve peformance in analytics queries.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementStore.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/expression/ExpressionService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/resourcetable/ResourceTableService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/resourcetable/ResourceTableStore.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/jdbc/JdbcResourceTableStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/expression/ExpressionServiceTest.java
dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/indicator.xsl
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/resourcetable/GenerateResourceTableAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/resourceTable.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/resourceTableForm.vm
--
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/dataelement/DataElementService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java 2013-03-07 14:10:37 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java 2013-05-27 11:07:26 +0000
@@ -30,6 +30,7 @@
import java.util.Collection;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.hisp.dhis.common.ListMap;
import org.hisp.dhis.dataset.DataSet;
@@ -290,9 +291,10 @@
* Returns a mapping of data element uid and associated category option combo
* uids.
*
+ * @param dataElementUids the uids of the data elements to include in the map.
* @return a ListMap.
*/
- ListMap<String, String> getDataElementCategoryOptionComboMap();
+ ListMap<String, String> getDataElementCategoryOptionComboMap( Set<String> dataElementUids );
Map<String, Integer> getDataElementUidIdMap();
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementStore.java 2013-03-07 14:10:37 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementStore.java 2013-05-27 11:07:26 +0000
@@ -28,6 +28,7 @@
*/
import java.util.Collection;
+import java.util.Set;
import org.hisp.dhis.common.GenericNameableObjectStore;
import org.hisp.dhis.common.ListMap;
@@ -171,9 +172,10 @@
* Returns a mapping of data element uid and associated category option combo
* uids.
*
+ * @param dataElementUids the uids of the data elements to include in the map.
* @return a ListMap.
*/
- ListMap<String, String> getDataElementCategoryOptionComboMap();
+ ListMap<String, String> getDataElementCategoryOptionComboMap( Set<String> dataElementUids );
Collection<DataElement> get( DataSet dataSet, String key, Integer max );
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/expression/ExpressionService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/expression/ExpressionService.java 2013-05-10 12:07:51 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/expression/ExpressionService.java 2013-05-27 11:07:26 +0000
@@ -68,11 +68,13 @@
final String OPERAND_EXPRESSION = "#\\{(\\w+)\\.?(\\w*)\\}";
final String OPERAND_UID_EXPRESSION = "(\\w+)\\.?(\\w*)";
+ final String DATA_ELEMENT_TOTAL_EXPRESSION = "#\\{(\\w+)\\}";
final String CONSTANT_EXPRESSION = "C\\{(\\w+)\\}";
final String DAYS_EXPRESSION = "\\[days\\]";
final Pattern OPERAND_PATTERN = Pattern.compile( OPERAND_EXPRESSION );
final Pattern OPERAND_UID_PATTERN = Pattern.compile( OPERAND_UID_EXPRESSION );
+ final Pattern DATA_ELEMENT_TOTAL_PATTERN = Pattern.compile( DATA_ELEMENT_TOTAL_EXPRESSION );
final Pattern CONSTANT_PATTERN = Pattern.compile( CONSTANT_EXPRESSION );
final Pattern DAYS_PATTERN = Pattern.compile( DAYS_EXPRESSION );
@@ -134,6 +136,14 @@
Map<String, Double> constantMap, Integer days );
/**
+ * Returns the uids of the data element totals in the given expression.
+ *
+ * @param expression the expression.
+ * @return a set of data element uids.
+ */
+ Set<String> getDataElementTotalUids( String expression );
+
+ /**
* Returns all DataElements included in the given expression string.
*
* @param expression the expression string.
=== 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-03-01 17:59:05 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/resourcetable/ResourceTableService.java 2013-05-27 11:07:26 +0000
@@ -29,7 +29,6 @@
/**
* @author Lars Helge Overland
- * @version $Id: ResourceTableService.java 5459 2008-06-26 01:12:03Z larshelg $
*/
public interface ResourceTableService
{
@@ -81,4 +80,10 @@
* Generates a resource table for all periods.
*/
void generatePeriodTable();
+
+ /**
+ * Generates a resource table for all data elements and relevant category
+ * option combinations.
+ */
+ void generateDataElementCategoryOptionComboTable();
}
=== 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 2013-03-05 10:28:10 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/resourcetable/ResourceTableStore.java 2013-05-27 11:07:26 +0000
@@ -45,7 +45,7 @@
final String TABLE_NAME_ORGANISATION_UNIT_STRUCTURE = "_orgunitstructure";
final String TABLE_NAME_DATA_ELEMENT_STRUCTURE = "_dataelementstructure";
final String TABLE_NAME_PERIOD_STRUCTURE = "_periodstructure";
- final String TABLE_NAME_PERIOD_NO_DISAGGREGATION_STRUCTURE = "_period_no_disagg_structure";
+ final String TABLE_NAME_DATA_ELEMENT_CATEGORY_OPTION_COMBO = "_dataelementcategoryoptioncombo";
/**
* Performs a batch update.
@@ -56,28 +56,16 @@
*/
void batchUpdate( int columns, String tableName, List<Object[]> batchArgs );
- // -------------------------------------------------------------------------
- // OrganisationUnitStructure
- // -------------------------------------------------------------------------
-
/**
* Creates a table.
*/
void createOrganisationUnitStructure( int maxLevel );
- // -------------------------------------------------------------------------
- // DataElementCategoryOptionComboName
- // -------------------------------------------------------------------------
-
/**
* Creates a table.
*/
void createDataElementCategoryOptionComboName();
- // -------------------------------------------------------------------------
- // GroupSetStructure
- // -------------------------------------------------------------------------
-
/**
* Creates table.
*
@@ -115,4 +103,9 @@
* Creates table.
*/
void createPeriodStructure();
+
+ /**
+ * Creates and generates table.
+ */
+ public void createAndGenerateDataElementCategoryOptionCombo();
}
=== 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-04-22 17:04:51 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java 2013-05-27 11:07:26 +0000
@@ -172,6 +172,9 @@
generatePeriodTable();
log.info( "Period table generated" );
+ generateDataElementCategoryOptionComboTable();
+ log.info( "Data element category option combo table generated" );
+
sqlViewService.createAllViewTables();
}
@@ -526,4 +529,13 @@
resourceTableStore.batchUpdate( PeriodType.PERIOD_TYPES.size() + 3, TABLE_NAME_PERIOD_STRUCTURE, batchArgs );
}
+
+ // -------------------------------------------------------------------------
+ // DataElementCategoryOptionComboTable
+ // -------------------------------------------------------------------------
+
+ public void generateDataElementCategoryOptionComboTable()
+ {
+ resourceTableStore.createAndGenerateDataElementCategoryOptionCombo();
+ }
}
=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/jdbc/JdbcResourceTableStore.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/jdbc/JdbcResourceTableStore.java 2013-03-05 22:03:40 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/jdbc/JdbcResourceTableStore.java 2013-05-27 11:07:26 +0000
@@ -274,4 +274,38 @@
jdbcTemplate.update( sql );
}
+
+ // -------------------------------------------------------------------------
+ // DataElementCategoryOptionComboTable
+ // -------------------------------------------------------------------------
+
+ public void createAndGenerateDataElementCategoryOptionCombo()
+ {
+ try
+ {
+ jdbcTemplate.update( "DROP TABLE IF EXISTS " + TABLE_NAME_DATA_ELEMENT_CATEGORY_OPTION_COMBO );
+ }
+ catch ( BadSqlGrammarException ex )
+ {
+ // Do nothing, table does not exist
+ }
+
+ final String sql =
+ "select de.uid as dataelementuid, coc.uid as categoryoptioncombouid " +
+ "into " + TABLE_NAME_DATA_ELEMENT_CATEGORY_OPTION_COMBO + " " +
+ "from dataelement de " +
+ "join categorycombos_optioncombos cc on de.categorycomboid = cc.categorycomboid " +
+ "join categoryoptioncombo coc on cc.categoryoptioncomboid = coc.categoryoptioncomboid";
+
+ log.info( "Create data element category option combo SQL: " + sql );
+
+ jdbcTemplate.update( sql );
+
+ final String index = "CREATE INDEX dataelement_categoryoptioncombo ON " +
+ TABLE_NAME_DATA_ELEMENT_CATEGORY_OPTION_COMBO + " (dataelementuid, categoryoptioncombouid)";
+
+ log.info( "Create data element category option combo index: " + index );
+
+ jdbcTemplate.update( index );
+ }
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java 2013-03-07 14:10:37 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java 2013-05-27 11:07:26 +0000
@@ -342,9 +342,9 @@
return i18n( i18nService, dataElementStore.getDataElementsByAggregationLevel( aggregationLevel ) );
}
- public ListMap<String, String> getDataElementCategoryOptionComboMap()
+ public ListMap<String, String> getDataElementCategoryOptionComboMap( Set<String> dataElementUids )
{
- return dataElementStore.getDataElementCategoryOptionComboMap();
+ return dataElementStore.getDataElementCategoryOptionComboMap( dataElementUids );
}
public Map<String, Integer> getDataElementUidIdMap()
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.java 2013-03-07 14:10:37 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.java 2013-05-27 11:07:26 +0000
@@ -44,6 +44,7 @@
import org.hisp.dhis.dataelement.DataElementStore;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.system.util.ConversionUtils;
+import org.hisp.dhis.system.util.TextUtils;
import org.springframework.jdbc.core.RowCallbackHandler;
/**
@@ -223,11 +224,12 @@
return getQuery( hql ).setInteger( "aggregationLevel", aggregationLevel ).list();
}
- public ListMap<String, String> getDataElementCategoryOptionComboMap()
+ public ListMap<String, String> getDataElementCategoryOptionComboMap( Set<String> dataElementUids )
{
- final String sql = "select de.uid, coc.uid from dataelement de "
- + "join categorycombos_optioncombos cc on de.categorycomboid = cc.categorycomboid "
- + "join categoryoptioncombo coc on cc.categoryoptioncomboid = coc.categoryoptioncomboid";
+ final String sql =
+ "select dataelementuid, categoryoptioncombouid " +
+ "from _dataelementcategoryoptioncombo " +
+ "where dataelementuid in (" + TextUtils.getQuotedCommaDelimitedString( dataElementUids ) + ")";
final ListMap<String, String> map = new ListMap<String, String>();
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java 2013-03-11 12:18:15 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java 2013-05-27 11:07:26 +0000
@@ -68,8 +68,6 @@
*
* @author Margrethe Store
* @author Lars Helge Overland
- * @version $Id: DefaultExpressionService.java 6463 2008-11-24 12:05:46Z
- * larshelg $
*/
public class DefaultExpressionService
implements ExpressionService
@@ -202,7 +200,24 @@
return dataElementsInExpression;
}
-
+
+ public Set<String> getDataElementTotalUids( String expression )
+ {
+ Set<String> uids = new HashSet<String>();
+
+ if ( expression != null )
+ {
+ final Matcher matcher = DATA_ELEMENT_TOTAL_PATTERN.matcher( expression );
+
+ while ( matcher.find() )
+ {
+ uids.add( matcher.group( 1 ) );
+ }
+ }
+
+ return uids;
+ }
+
@Transactional
public Set<DataElementCategoryOptionCombo> getOptionCombosInExpression( String expression )
{
@@ -460,17 +475,28 @@
indicator.setExplodedDenominator( substituteExpression( indicator.getDenominator(), days ) );
}
- final ListMap<String, String> dataElementMap = dataElementService.getDataElementCategoryOptionComboMap();
+ Set<String> dataElementTotals = new HashSet<String>();
for ( Indicator indicator : indicators )
{
- indicator.setExplodedNumerator( explodeExpression( indicator.getExplodedNumerator() != null ? indicator.getExplodedNumerator() : "", dataElementMap ) );
- indicator.setExplodedDenominator( explodeExpression( indicator.getExplodedDenominator() != null ? indicator.getExplodedDenominator() : "", dataElementMap ) );
- }
+ dataElementTotals.addAll( getDataElementTotalUids( indicator.getNumerator() ) );
+ dataElementTotals.addAll( getDataElementTotalUids( indicator.getDenominator() ) );
+ }
+
+ if ( !dataElementTotals.isEmpty() )
+ {
+ final ListMap<String, String> dataElementMap = dataElementService.getDataElementCategoryOptionComboMap( dataElementTotals );
+
+ for ( Indicator indicator : indicators )
+ {
+ indicator.setExplodedNumerator( explodeExpression( indicator.getExplodedNumerator() != null ? indicator.getExplodedNumerator() : "", dataElementMap ) );
+ indicator.setExplodedDenominator( explodeExpression( indicator.getExplodedDenominator() != null ? indicator.getExplodedDenominator() : "", dataElementMap ) );
+ }
+ }
}
}
- private String explodeExpression( String expression, ListMap<String, String> dataElementMap )
+ private String explodeExpression( String expression, ListMap<String, String> dataElementOptionComboMap )
{
if ( expression == null || expression.isEmpty() )
{
@@ -486,7 +512,7 @@
{
final StringBuilder replace = new StringBuilder( PAR_OPEN );
- for ( String coc : dataElementMap.get( matcher.group( 1 ) ) )
+ for ( String coc : dataElementOptionComboMap.get( matcher.group( 1 ) ) )
{
replace.append( EXP_OPEN ).append( matcher.group( 1 ) ).append( SEPARATOR ).append(
coc ).append( EXP_CLOSE ).append( "+" );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/expression/ExpressionServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/expression/ExpressionServiceTest.java 2013-01-15 11:43:12 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/expression/ExpressionServiceTest.java 2013-05-27 11:07:26 +0000
@@ -27,12 +27,12 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.hisp.dhis.expression.Expression.SEPARATOR;
+import static org.hisp.dhis.expression.ExpressionService.DAYS_SYMBOL;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-import static org.hisp.dhis.expression.Expression.SEPARATOR;
-import static org.hisp.dhis.expression.ExpressionService.*;
import java.util.Collection;
import java.util.HashMap;
@@ -66,27 +66,19 @@
extends DhisTest
{
private DataElementCategoryOption categoryOptionA;
-
private DataElementCategoryOption categoryOptionB;
-
private DataElementCategoryOption categoryOptionC;
-
private DataElementCategoryOption categoryOptionD;
private DataElementCategory categoryA;
-
private DataElementCategory categoryB;
private DataElementCategoryCombo categoryCombo;
private DataElement dataElementA;
-
private DataElement dataElementB;
-
private DataElement dataElementC;
-
private DataElement dataElementD;
-
private DataElement dataElementE;
private Period period;
@@ -96,21 +88,16 @@
private DataElementCategoryOptionCombo categoryOptionCombo;
private Constant constantA;
-
+
private String expressionA;
-
private String expressionB;
-
private String expressionC;
-
- private String expressionD;
-
+ private String expressionD;
private String expressionE;
-
private String expressionF;
+ private String expressionG;
private String descriptionA;
-
private String descriptionB;
private Set<DataElement> dataElements = new HashSet<DataElement>();
@@ -199,6 +186,7 @@
expressionD = "#{" + dataElementA.getUid() + SEPARATOR + categoryOptionCombo.getUid() + "}+" + DAYS_SYMBOL;
expressionE = "#{" + dataElementA.getUid() + SEPARATOR + categoryOptionCombo.getUid() + "}*C{" + constantA.getUid() + "}";
expressionF = "#{" + dataElementA.getUid() + SEPARATOR + categoryOptionCombo.getUid() + "}";
+ expressionG = expressionF + "+#{" + dataElementB.getUid() + "}-#{" + dataElementC.getUid() + "}";
descriptionA = "Expression A";
descriptionB = "Expression B";
@@ -258,6 +246,19 @@
}
@Test
+ public void testGetDataElementTotalUids()
+ {
+ Set<String> uids = new HashSet<String>();
+ Set<String> empty = new HashSet<String>();
+
+ uids.add( dataElementB.getUid() );
+ uids.add( dataElementC.getUid() );
+
+ assertEquals( uids, expressionService.getDataElementTotalUids( expressionG ) );
+ assertEquals( empty, expressionService.getDataElementTotalUids( expressionA ) );
+ }
+
+ @Test
public void testGetOperandsInExpression()
{
Set<DataElementOperand> operands = expressionService.getOperandsInExpression( expressionA );
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/indicator.xsl'
--- dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/indicator.xsl 2012-04-08 20:23:29 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/resources/templates/html/indicator.xsl 2013-05-27 11:07:26 +0000
@@ -31,6 +31,14 @@
<td> <xsl:value-of select="d:description" /> </td>
</tr>
<tr>
+ <td>Numerator</td>
+ <td> <xsl:value-of select="d:numerator" /> </td>
+ </tr>
+ <tr>
+ <td>Numerator Description</td>
+ <td> <xsl:value-of select="d:numeratorDescription" /> </td>
+ </tr>
+ <tr>
<td>Denominator</td>
<td> <xsl:value-of select="d:denominator" /> </td>
</tr>
@@ -39,14 +47,6 @@
<td> <xsl:value-of select="d:denominatorDescription" /> </td>
</tr>
<tr>
- <td>Numerator</td>
- <td> <xsl:value-of select="d:numerator" /> </td>
- </tr>
- <tr>
- <td>Numerator Description</td>
- <td> <xsl:value-of select="d:numeratorDescription" /> </td>
- </tr>
- <tr>
<td>Annualized</td>
<td> <xsl:value-of select="d:annualized" /> </td>
</tr>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/resourcetable/GenerateResourceTableAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/resourcetable/GenerateResourceTableAction.java 2013-02-05 11:36:19 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/resourcetable/GenerateResourceTableAction.java 2013-05-27 11:07:26 +0000
@@ -61,6 +61,13 @@
this.resourceTableService = resourceTableService;
}
+ private CurrentUserService currentUserService;
+
+ public void setCurrentUserService( CurrentUserService currentUserService )
+ {
+ this.currentUserService = currentUserService;
+ }
+
// -------------------------------------------------------------------------
// Input & Output
// -------------------------------------------------------------------------
@@ -120,12 +127,12 @@
{
this.periodStructure = periodStructure;
}
-
- private CurrentUserService currentUserService;
-
- public void setCurrentUserService( CurrentUserService currentUserService )
+
+ private boolean dataElementCategoryOptionCombo;
+
+ public void setDataElementCategoryOptionCombo( boolean dataElementCategoryOptionCombo )
{
- this.currentUserService = currentUserService;
+ this.dataElementCategoryOptionCombo = dataElementCategoryOptionCombo;
}
private String message;
@@ -185,6 +192,11 @@
{
resourceTableService.generatePeriodTable();
}
+
+ if ( dataElementCategoryOptionCombo )
+ {
+ resourceTableService.generateDataElementCategoryOptionComboTable();
+ }
log.info( "'" + currentUserService.getCurrentUsername() + "': Generated resource tables" );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties 2013-04-22 08:10:07 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties 2013-05-27 11:07:26 +0000
@@ -319,4 +319,4 @@
generating_min_max_values=Generating min-max values
done=Done
period_structure=Period structure
-clear_analytics_tables=Clear analytics tables
\ No newline at end of file
+ data_element_category_option_combo=Data element category option combinations
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/resourceTable.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/resourceTable.js 2012-11-25 20:18:52 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/resourceTable.js 2013-05-27 11:07:26 +0000
@@ -11,9 +11,10 @@
var categoryOptionComboName = document.getElementById( "categoryOptionComboName" ).checked;
var dataElementStructure = document.getElementById( "dataElementStructure" ).checked;
var periodStructure = document.getElementById( "periodStructure" ).checked;
+ var dataElementCategoryOptionCombo = document.getElementById( "dataElementCategoryOptionCombo" ).checked;
if ( organisationUnit || dataElementGroupSetStructure || indicatorGroupSetStructure || organisationUnitGroupSetStructure ||
- categoryStructure || categoryOptionComboName || dataElementStructure || periodStructure )
+ categoryStructure || categoryOptionComboName || dataElementStructure || periodStructure || dataElementCategoryOptionCombo )
{
setWaitMessage( i18n_generating_resource_tables );
@@ -25,7 +26,8 @@
categoryStructure: categoryStructure,
categoryOptionComboName: categoryOptionComboName,
dataElementStructure: dataElementStructure,
- periodStructure: periodStructure
+ periodStructure: periodStructure,
+ dataElementCategoryOptionCombo: dataElementCategoryOptionCombo
};
$.ajax({
@@ -55,5 +57,6 @@
document.getElementById( "categoryStructure" ).checked = selected;
document.getElementById( "categoryOptionComboName" ).checked = selected;
document.getElementById( "dataElementStructure" ).checked = selected;
- document.getElementById( "periodStructure" ).checked = selected;
+ document.getElementById( "periodStructure" ).checked = selected;
+ document.getElementById( "dataElementCategoryOptionCombo" ).checked = selected;
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/resourceTableForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/resourceTableForm.vm 2012-11-25 20:18:52 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/resourceTableForm.vm 2013-05-27 11:07:26 +0000
@@ -47,6 +47,11 @@
<label for="periodStructure">$i18n.getString( "period_structure" ) <span style="color:#606060">(_periodstructure)</span></label>
</p>
+<p>
+ <input type="checkbox" name="resourceTableCheckBox" id="dataElementCategoryOptionCombo"/>
+ <label for="dataElementCategoryOptionCombo">$i18n.getString( "data_element_category_option_combo" ) <span style="color:#606060">(_dataelementcategoryoptioncombo)</span></label>
+</p>
+
<table>
<tr>
<td>