dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #07097
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1997: Add missed file.
------------------------------------------------------------
revno: 1997
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: trunk
timestamp: Sat 2010-08-28 19:24:02 +0700
message:
Add missed file.
added:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/RemoveMinMaxValueAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/responseInput.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/responseSuccess.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
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/RemoveMinMaxValueAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/RemoveMinMaxValueAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/RemoveMinMaxValueAction.java 2010-08-28 12:24:02 +0000
@@ -0,0 +1,186 @@
+package org.hisp.dhis.dataadmin.action.minmaxvalidation;
+
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @author Chau Thu Tran
+ * @version $Id$
+ */
+import java.util.Collection;
+
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.minmax.MinMaxDataElement;
+import org.hisp.dhis.minmax.MinMaxDataElementService;
+import org.hisp.dhis.minmax.validation.MinMaxValuesGenerationService;
+import org.hisp.dhis.options.SystemSettingManager;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
+
+import com.opensymphony.xwork2.Action;
+
+public class RemoveMinMaxValueAction
+implements Action
+{
+ // -------------------------------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------------------------------
+
+ private OrganisationUnitSelectionManager organisationUnitSelectionManager;
+
+ private DataSetService dataSetService;
+
+ private MinMaxValuesGenerationService minMaxValuesGenerationService;
+
+ private MinMaxDataElementService minMaxDataElementService;
+
+ private SystemSettingManager systemSettingManager;
+
+ // -------------------------------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------------------------------
+
+ private Integer[] dataSetIds;
+
+ private String message;
+
+ private I18n i18n;
+
+ // -------------------------------------------------------------------------------------------------
+ // Setters
+ // -------------------------------------------------------------------------------------------------
+
+ public void setOrganisationUnitSelectionManager( OrganisationUnitSelectionManager organisationUnitSelectionManager )
+ {
+ this.organisationUnitSelectionManager = organisationUnitSelectionManager;
+ }
+
+ public void setSystemSettingManager( SystemSettingManager systemSettingManager )
+ {
+ this.systemSettingManager = systemSettingManager;
+ }
+
+ public void setDataSetService( DataSetService dataSetService )
+ {
+ this.dataSetService = dataSetService;
+ }
+
+ public void setMessage( String message )
+ {
+ this.message = message;
+ }
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ public void setI18n( I18n i18n )
+ {
+ this.i18n = i18n;
+ }
+
+ public void setMinMaxValuesGenerationService( MinMaxValuesGenerationService minMaxValuesGenerationService )
+ {
+ this.minMaxValuesGenerationService = minMaxValuesGenerationService;
+ }
+
+ public void setMinMaxDataElementService( MinMaxDataElementService minMaxDataElementService )
+ {
+ this.minMaxDataElementService = minMaxDataElementService;
+ }
+
+ public void setDataSetIds( Integer[] dataSetIds )
+ {
+ this.dataSetIds = dataSetIds;
+ }
+
+ // -------------------------------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------------------------------
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ if ( dataSetIds == null )
+ {
+ message = i18n.getString( "not_choose_dataset" );
+ organisationUnitSelectionManager.clearSelectedOrganisationUnits();
+ return INPUT;
+ }
+
+ Collection<OrganisationUnit> orgUnits = organisationUnitSelectionManager.getSelectedOrganisationUnits();
+ if ( orgUnits == null || orgUnits.size() ==0 )
+ {
+ message = i18n.getString( "not_choose_organisation" );
+ return INPUT;
+ }
+
+ // Get factor
+ Double factor = (Double) systemSettingManager.getSystemSetting( SystemSettingManager.KEY_FACTOR_OF_DEVIATION,
+ 2.0 );
+
+ for ( Integer dataSetId : dataSetIds )
+ {
+ // Get dataset
+ DataSet dataSet = dataSetService.getDataSet( dataSetId );
+
+ for ( OrganisationUnit orgUnit : orgUnits )
+ {
+ if ( orgUnit.getDataSets().contains( dataSet ) )
+ {
+
+ // Get min/max values for dataelements into dataset
+ Collection<MinMaxDataElement> minMaxDataElements = (Collection<MinMaxDataElement>) minMaxValuesGenerationService
+ .getMinMaxValues( orgUnit, dataSet.getDataElements(), factor );
+
+ // Save min / max value
+ for ( MinMaxDataElement minMaxDataElement : minMaxDataElements )
+ {
+ MinMaxDataElement minMaxValue = minMaxDataElementService.getMinMaxDataElement(
+ minMaxDataElement.getSource(), minMaxDataElement.getDataElement(), minMaxDataElement
+ .getOptionCombo() );
+
+ if ( minMaxValue != null )
+ {
+ minMaxValue.setMax( minMaxDataElement.getMax() );
+ minMaxValue.setMin( minMaxDataElement.getMin() );
+ minMaxDataElementService.deleteMinMaxDataElement( minMaxValue );
+ }
+ }
+ }
+ }
+ }
+
+ message = i18n.getString( "remove_values_success" );
+
+ return SUCCESS;
+ }
+}
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/responseInput.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/responseInput.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/responseInput.vm 2010-08-28 12:24:02 +0000
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<message type="input">$encoder.xmlEncode( $message )</message>
+
+
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/responseSuccess.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/responseSuccess.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/responseSuccess.vm 2010-08-28 12:24:02 +0000
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<message type="success">$encoder.xmlEncode( $message )</message>
+
+