=== removed file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SaveValueAction.java' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SaveValueAction.java 2010-09-24 06:12:10 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SaveValueAction.java 1970-01-01 00:00:00 +0000 @@ -1,241 +0,0 @@ -package org.hisp.dhis.de.action; - -/* - * 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. - */ - -import java.util.Date; - -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.DataElementService; -import org.hisp.dhis.datavalue.DataValue; -import org.hisp.dhis.datavalue.DataValueAudit; -import org.hisp.dhis.datavalue.DataValueAuditService; -import org.hisp.dhis.datavalue.DataValueService; -import org.hisp.dhis.de.state.SelectedStateManager; -import org.hisp.dhis.organisationunit.OrganisationUnit; -import org.hisp.dhis.organisationunit.OrganisationUnitService; -import org.hisp.dhis.period.Period; -import org.hisp.dhis.user.CurrentUserService; - -import com.opensymphony.xwork2.Action; - -/** - * @author Torgeir Lorange Ostby - */ -public class SaveValueAction - implements Action -{ - private static final Log log = LogFactory.getLog( SaveValueAction.class ); - - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private CurrentUserService currentUserService; - - public void setCurrentUserService( CurrentUserService currentUserService ) - { - this.currentUserService = currentUserService; - } - - private DataElementService dataElementService; - - public void setDataElementService( DataElementService dataElementService ) - { - this.dataElementService = dataElementService; - } - - private DataValueService dataValueService; - - public void setDataValueService( DataValueService dataValueService ) - { - this.dataValueService = dataValueService; - } - - private DataValueAuditService dataValueAuditService; - - public void setDataValueAuditService( DataValueAuditService dataValueAuditService ) - { - this.dataValueAuditService = dataValueAuditService; - } - - private SelectedStateManager selectedStateManager; - - public void setSelectedStateManager( SelectedStateManager selectedStateManager ) - { - this.selectedStateManager = selectedStateManager; - } - - private DataElementCategoryService categoryService; - - public void setCategoryService( DataElementCategoryService categoryService ) - { - this.categoryService = categoryService; - } - - private OrganisationUnitService organisationUnitService; - - public void setOrganisationUnitService( OrganisationUnitService organisationUnitService ) - { - this.organisationUnitService = organisationUnitService; - } - - // ------------------------------------------------------------------------- - // Input/output - // ------------------------------------------------------------------------- - - private String value; - - public void setValue( String value ) - { - this.value = value; - } - - private int dataElementId; - - public void setDataElementId( int dataElementId ) - { - this.dataElementId = dataElementId; - } - - public int getDataElementId() - { - return dataElementId; - } - - private int organisationUnitId; - - public void setOrganisationUnitId( int organisationUnitId ) - { - this.organisationUnitId = organisationUnitId; - } - - private int statusCode; - - public int getStatusCode() - { - return statusCode; - } - - private Date timestamp; - - public Date getTimestamp() - { - return timestamp; - } - - private String storedBy; - - public String getStoredBy() - { - return storedBy; - } - - // ------------------------------------------------------------------------- - // Action implementation - // ------------------------------------------------------------------------- - - public String execute() - { - OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId ); - - Period period = selectedStateManager.getSelectedPeriod(); -System.out.println("\n\n\n ++++ selected period : " + period + " +++++ \n" ); - DataElement dataElement = dataElementService.getDataElement( dataElementId ); - - storedBy = currentUserService.getCurrentUsername(); - - if ( storedBy == null ) - { - storedBy = "[unknown]"; - } - - if ( value != null && value.trim().length() == 0 ) - { - value = null; - } - - if ( value != null ) - { - value = value.trim(); - } - - // --------------------------------------------------------------------- - // Save or update - // --------------------------------------------------------------------- - - DataElementCategoryOptionCombo defaultOptionCombo = categoryService.getDefaultDataElementCategoryOptionCombo(); - - DataValue dataValue = dataValueService.getDataValue( organisationUnit, dataElement, period, defaultOptionCombo ); - - if ( dataValue == null ) - { - if ( value != null ) - { - log.debug( "Adding DataValue" ); - - dataValue = new DataValue( dataElement, period, organisationUnit, value, storedBy, new Date(), null, - defaultOptionCombo ); - - dataValueService.addDataValue( dataValue ); - } - } - else - { - log.debug( "Updating DataValue" ); - - DataValueAudit audit = new DataValueAudit( dataValue, dataValue.getValue(), storedBy, new Date(), "" ); - - dataValue.setValue( value ); - dataValue.setTimestamp( new Date() ); - dataValue.setStoredBy( storedBy ); - - dataValueService.updateDataValue( dataValue ); - - // ----------------------------------------------------------------- - // Add DataValueAudit - // ----------------------------------------------------------------- - - if ( value != null ) - { - dataValueAuditService.addDataValueAudit( audit ); - } - } - - if ( dataValue != null ) - { - this.timestamp = dataValue.getTimestamp(); - this.storedBy = dataValue.getStoredBy(); - } - - return SUCCESS; - } -} === modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DefaultDataEntryScreenManager.java' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DefaultDataEntryScreenManager.java 2010-11-11 18:03:00 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/screen/DefaultDataEntryScreenManager.java 2010-11-11 21:43:28 +0000 @@ -37,7 +37,6 @@ import java.util.Collection; import java.util.HashMap; import java.util.HashSet; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.regex.Matcher; @@ -49,7 +48,6 @@ import org.hisp.dhis.customvalue.CustomValueService; import org.hisp.dhis.dataelement.CalculatedDataElement; import org.hisp.dhis.dataelement.DataElement; -import org.hisp.dhis.dataelement.DataElementCategoryCombo; import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; import org.hisp.dhis.dataelement.DataElementCategoryService; import org.hisp.dhis.dataelement.DataElementService; === modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/state/DefaultStatefulDataValueSaver.java' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/state/DefaultStatefulDataValueSaver.java 2009-10-18 22:44:41 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/state/DefaultStatefulDataValueSaver.java 2010-11-11 21:43:28 +0000 @@ -2,15 +2,13 @@ import java.util.Date; -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.DataElementService; import org.hisp.dhis.datavalue.DataValue; import org.hisp.dhis.datavalue.DataValueService; -import org.hisp.dhis.de.action.SaveValueAction; +import org.hisp.dhis.de.action.multidimensional.SaveValueAction; import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.period.Period; import org.hisp.dhis.user.CurrentUserService; @@ -27,8 +25,6 @@ public class DefaultStatefulDataValueSaver implements StatefulDataValueSaver { - private static final Log LOG = LogFactory.getLog( SaveValueAction.class ); - // ------------------------------------------------------------------------- // Dependencies // ------------------------------------------------------------------------- @@ -104,8 +100,6 @@ { if ( value != null ) { - LOG.debug( "Adding DataValue, value added" ); - dataValue = new DataValue( dataElement, period, organisationUnit, value, storedBy, new Date(), null, optionCombo ); dataValueService.addDataValue( dataValue ); @@ -113,8 +107,6 @@ } else { - LOG.debug( "Updating DataValue, value added/changed" ); - dataValue.setValue( value ); dataValue.setTimestamp( new Date() ); dataValue.setStoredBy( storedBy ); === modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml 2010-11-11 18:03:00 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml 2010-11-11 21:43:28 +0000 @@ -111,17 +111,6 @@ ref="org.hisp.dhis.de.screen.DataEntryScreenManager" /> - - - - - - - - - - === modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml 2010-11-11 18:03:00 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml 2010-11-11 21:43:28 +0000 @@ -81,12 +81,6 @@ F_DATAVALUE_ADD,F_DATAVALUE_UPDATE,F_DATAVALUE_DELETE - - status.vm - plainTextError - F_DATAVALUE_ADD,F_DATAVALUE_UPDATE,F_DATAVALUE_DELETE - - status.vm plainTextError === modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/multidimensional/form.vm' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/multidimensional/form.vm 2010-10-28 09:17:13 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/multidimensional/form.vm 2010-11-11 21:43:28 +0000 @@ -115,7 +115,7 @@ #if( $dataElement.type == "bool" ) - @@ -129,7 +129,7 @@ #end #end #if($coun>0) - @@ -89,7 +89,7 @@ #end #end #if($coun>0) - #foreach($customValue in $customValues) #if($dataElement.id == $customValue.dataElement.id && $optionCombo.id == $customValue.optionCombo.id) @@ -98,7 +98,7 @@ #end #else - + #end #end #end @@ -116,9 +116,9 @@ #if( $dataElement.aggregationOperator == "sum" && $dataElement.type != "string") - + #elseif( $dataElement.type != "string") - + #end #set( $tabIndex = $tabIndex + 1 )