dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #31953
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16326: Reverted r 16325
------------------------------------------------------------
revno: 16326
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-08-06 00:30:52 +0200
message:
Reverted r 16325
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/expression/ExpressionService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/maintenance/PerformMaintenanceAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/maintenance.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/maintenanceForm.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/expression/ExpressionService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/expression/ExpressionService.java 2014-08-05 16:23:58 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/expression/ExpressionService.java 2014-08-05 22:30:52 +0000
@@ -363,11 +363,4 @@
* @param indicators the collection of Indicators.
*/
Set<DataElementOperand> getOperandsInIndicators( Collection<Indicator> indicators );
-
- /**
- * the data element and option combo of expression formula, which doesn't
- * match with any data elements and option combos existed in database, will
- * be created and saved into database
- */
- void updateDataElementsInExpression();
}
=== 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 2014-08-05 16:23:58 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java 2014-08-05 22:30:52 +0000
@@ -36,7 +36,6 @@
import static org.hisp.dhis.system.util.MathUtils.calculateExpression;
import static org.hisp.dhis.system.util.MathUtils.isEqual;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
@@ -53,12 +52,9 @@
import org.hisp.dhis.constant.Constant;
import org.hisp.dhis.constant.ConstantService;
import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategory;
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
-import org.hisp.dhis.dataelement.DataElementCategoryOption;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
import org.hisp.dhis.dataelement.DataElementCategoryService;
-import org.hisp.dhis.dataelement.DataElementDomain;
import org.hisp.dhis.dataelement.DataElementOperand;
import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.indicator.Indicator;
@@ -935,93 +931,6 @@
return operands;
}
- public void updateDataElementsInExpression()
- {
- Collection<Expression> expressionList = expressionStore.getAll();
-
- for( Expression expression : expressionList )
- {
- final Matcher matcher = OPERAND_PATTERN.matcher( expression.getExpression() );
-
- int i = 0;
- String description = expression.getDescription();
- while ( matcher.find() )
- {
- String optionComboUid = matcher.group( 2 );
- DataElementCategoryOptionCombo optionCombo = categoryService.
- getDataElementCategoryOptionCombo( optionComboUid );
- DataElementCategoryCombo categoryCombo = null;
- if( optionCombo != null)
- {
- categoryCombo = optionCombo.getCategoryCombo();
- }
- else
- {
- // Add Option
-
- DataElementCategoryOption option = new DataElementCategoryOption( description );
- option.setCode( optionComboUid );
- categoryService.addDataElementCategoryOption( option );
-
- // Add category
-
- DataElementCategory category = new DataElementCategory();
- category.setName( description );
- category.setDataDimension( false );
- category.setDataDimensionType( DataElementCategoryCombo.DIMENSION_TYPE_DISAGGREGATION );
-
- List<DataElementCategoryOption> categoryOptions = new ArrayList<DataElementCategoryOption>();
- categoryOptions.add( option );
- category.setCategoryOptions( categoryOptions );
- categoryService.addDataElementCategory( category );
-
-
- // Add CategoryCombo
-
- categoryCombo = new DataElementCategoryCombo();
- categoryCombo.setName( description );
- categoryCombo.setDimensionType( DataElementCategoryCombo.DIMENSION_TYPE_DISAGGREGATION );
- categoryCombo.setSkipTotal( false );
-
- List<DataElementCategory> categories = new ArrayList<DataElementCategory>();
- categories.add( category );
- categoryCombo.setCategories( categories );
- int categoryComboId = categoryService.addDataElementCategoryCombo( categoryCombo );
- categoryCombo.setId( categoryComboId );
-
- // Generate OptionCombo
- categoryService.generateOptionCombos( categoryCombo );
-
- optionCombo = categoryCombo.getOptionCombos().iterator().next();
- optionCombo.setUid( optionComboUid );
- categoryService.updateDataElementCategoryOptionCombo( optionCombo );
- }
-
- String dataElementUid = matcher.group( 1 ) ;
- DataElement dataElement = dataElementService.getDataElement( dataElementUid );
-
- if ( dataElement == null )
- {
- dataElement = new DataElement();
- dataElement.setUid( dataElementUid );
- dataElement.setName( description );
- int length = ( expression.getDescription().length() < 50 ) ? expression.getDescription().length() : 49;
- dataElement.setShortName( expression.getDescription().substring( 0, length ) );
- dataElement.setType( DataElement.VALUE_TYPE_INT );
- dataElement.setNumberType( DataElement.VALUE_TYPE_NUMBER );
- dataElement.setDomainType( DataElementDomain.AGGREGATE );
- dataElement.setAggregationOperator( DataElement.AGGREGATION_OPERATOR_SUM );
- dataElement.setCategoryCombo( categoryCombo );
-
- dataElementService.addDataElement( dataElement );
- }
-
- i++;
- description += "" + i;
- }
- }
- }
-
// -------------------------------------------------------------------------
// Supportive methods
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/maintenance/PerformMaintenanceAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/maintenance/PerformMaintenanceAction.java 2014-08-05 16:23:58 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/maintenance/PerformMaintenanceAction.java 2014-08-05 22:30:52 +0000
@@ -37,10 +37,8 @@
import org.hisp.dhis.completeness.DataSetCompletenessService;
import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.datamart.DataMartManager;
-import org.hisp.dhis.expression.ExpressionService;
import org.hisp.dhis.maintenance.MaintenanceService;
import org.hisp.dhis.user.CurrentUserService;
-import org.springframework.beans.factory.annotation.Autowired;
import com.opensymphony.xwork2.Action;
@@ -52,30 +50,30 @@
implements Action
{
private static final Log log = LogFactory.getLog( PerformMaintenanceAction.class );
-
+
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
- @Resource( name = "org.hisp.dhis.analytics.AnalyticsTableService" )
+ @Resource(name="org.hisp.dhis.analytics.AnalyticsTableService")
private AnalyticsTableService analyticsTableService;
- @Resource( name = "org.hisp.dhis.analytics.CompletenessTableService" )
+ @Resource(name="org.hisp.dhis.analytics.CompletenessTableService")
private AnalyticsTableService completenessTableService;
-
- @Resource( name = "org.hisp.dhis.analytics.CompletenessTargetTableService" )
+
+ @Resource(name="org.hisp.dhis.analytics.CompletenessTargetTableService")
private AnalyticsTableService completenessTargetTableService;
-
- @Resource( name = "org.hisp.dhis.analytics.EventAnalyticsTableService" )
+
+ @Resource(name="org.hisp.dhis.analytics.EventAnalyticsTableService")
private AnalyticsTableService eventAnalyticsTableService;
-
+
private MaintenanceService maintenanceService;
public void setMaintenanceService( MaintenanceService maintenanceService )
{
this.maintenanceService = maintenanceService;
}
-
+
private DataSetCompletenessService completenessService;
public void setCompletenessService( DataSetCompletenessService completenessService )
@@ -84,12 +82,12 @@
}
private AggregatedDataValueService aggregatedDataValueService;
-
+
public void setAggregatedDataValueService( AggregatedDataValueService aggregatedDataValueService )
{
this.aggregatedDataValueService = aggregatedDataValueService;
}
-
+
private DataMartManager dataMartManager;
public void setDataMartManager( DataMartManager dataMartManager )
@@ -103,23 +101,20 @@
{
this.currentUserService = currentUserService;
}
-
+
private DataElementCategoryService categoryService;
public void setCategoryService( DataElementCategoryService categoryService )
{
this.categoryService = categoryService;
}
-
- @Autowired
- private ExpressionService expressionService;
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
-
+
private boolean clearAnalytics;
-
+
public void setClearAnalytics( boolean clearAnalytics )
{
this.clearAnalytics = clearAnalytics;
@@ -133,7 +128,7 @@
}
public boolean dataMartIndex;
-
+
public void setDataMartIndex( boolean dataMartIndex )
{
this.dataMartIndex = dataMartIndex;
@@ -145,21 +140,21 @@
{
this.zeroValues = zeroValues;
}
-
+
private boolean dataSetCompleteness;
public void setDataSetCompleteness( boolean dataSetCompleteness )
{
this.dataSetCompleteness = dataSetCompleteness;
}
-
+
private boolean prunePeriods;
public void setPrunePeriods( boolean prunePeriods )
{
this.prunePeriods = prunePeriods;
}
-
+
private boolean updateCategoryOptionCombos;
public void setUpdateCategoryOptionCombos( boolean updateCategoryOptionCombos )
@@ -167,23 +162,15 @@
this.updateCategoryOptionCombos = updateCategoryOptionCombos;
}
- private boolean updateExpression;
-
- public void setUpdateExpression( boolean updateExpression )
- {
- this.updateExpression = updateExpression;
- }
-
-
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
-
- public String execute()
+
+ public String execute()
throws Exception
{
String username = currentUserService.getCurrentUsername();
-
+
if ( clearAnalytics )
{
analyticsTableService.dropTables();
@@ -191,68 +178,61 @@
completenessTargetTableService.dropTables();
eventAnalyticsTableService.dropTables();
}
-
+
if ( clearDataMart )
{
aggregatedDataValueService.dropDataMart();
aggregatedDataValueService.createDataMart();
-
+
log.info( "'" + username + "': Cleared data mart" );
}
-
+
if ( dataMartIndex )
{
dataMartManager.dropDataValueIndex();
dataMartManager.dropIndicatorValueIndex();
dataMartManager.dropOrgUnitDataValueIndex();
dataMartManager.dropOrgUnitIndicatorValueIndex();
-
+
dataMartManager.createDataValueIndex();
dataMartManager.createIndicatorValueIndex();
dataMartManager.createOrgUnitDataValueIndex();
dataMartManager.createOrgUnitIndicatorValueIndex();
-
+
completenessService.dropIndex();
completenessService.createIndex();
-
+
log.info( "'" + username + "': Rebuilt data mart indexes" );
}
-
+
if ( zeroValues )
{
maintenanceService.deleteZeroDataValues();
-
+
log.info( "Cleared zero values" );
}
-
+
if ( dataSetCompleteness )
{
completenessService.deleteDataSetCompleteness();
-
+
log.info( "'" + username + "': Cleared data completeness" );
}
-
+
if ( prunePeriods )
{
maintenanceService.prunePeriods();
-
+
log.info( "'" + username + "': Pruned periods" );
}
-
+
if ( updateCategoryOptionCombos )
{
categoryService.updateAllOptionCombos();
-
+
log.info( "'" + username + "': Updated category option combos" );
}
-
- if ( updateExpression )
- {
- expressionService.updateDataElementsInExpression();
-
- log.info( "'" + username + "': Updated data elements and category option combos in expression" );
- }
-
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/maintenance.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/maintenance.js 2014-08-05 16:23:58 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/maintenance.js 2014-08-05 22:30:52 +0000
@@ -8,9 +8,8 @@
var dataSetCompleteness = document.getElementById( "dataSetCompleteness" ).checked;
var prunePeriods = document.getElementById( "prunePeriods" ).checked;
var updateCategoryOptionCombos = document.getElementById( "updateCategoryOptionCombos" ).checked;
- var updateExpression = document.getElementById( "updateExpression" ).checked;
- if ( clearAnalytics || clearDataMart || dataMartIndex || zeroValues || dataSetCompleteness || prunePeriods || updateCategoryOptionCombos || updateExpression )
+ if ( clearAnalytics || clearDataMart || dataMartIndex || zeroValues || dataSetCompleteness || prunePeriods || updateCategoryOptionCombos )
{
setWaitMessage( i18n_performing_maintenance );
@@ -20,8 +19,7 @@
"&zeroValues=" + zeroValues +
"&dataSetCompleteness=" + dataSetCompleteness +
"&prunePeriods=" + prunePeriods +
- "&updateCategoryOptionCombos=" + updateCategoryOptionCombos +
- "&updateExpression=" + updateExpression;
+ "&updateCategoryOptionCombos=" + updateCategoryOptionCombos;
$.ajax({
type: "POST",
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/maintenanceForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/maintenanceForm.vm 2014-08-05 16:23:58 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/maintenanceForm.vm 2014-08-05 22:30:52 +0000
@@ -42,11 +42,6 @@
</p>
<p>
- <input type="checkbox" id="updateExpression"/>
- <label for="updateExpression">$i18n.getString( "update_the_data_elements_and_option_combos_in_expression" )</label>
-</p>
-
-<p>
<input type="button" value="$i18n.getString( 'perform_maintenance' )" onclick="performMaintenance()" style="width:170px"/>
</p>