=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/FacilityReportingServiceImpl.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/FacilityReportingServiceImpl.java 2010-11-30 19:36:40 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/FacilityReportingServiceImpl.java 2010-12-01 07:03:19 +0000 @@ -81,6 +81,8 @@ private org.hisp.dhis.dataset.DataSetService dataSetService; private org.hisp.dhis.i18n.I18nService i18nService; + + private org.hisp.dhis.datalock.DataSetLockService dataSetLockService; // ------------------------------------------------------------------------- // Service methods @@ -124,6 +126,7 @@ ds.setId( dataSet.getId() ); ds.setName( dataSet.getName() ); +// ds.setVersionDataSet( dataSet.getVersionDataSet() ); ds.setPeriodType( dataSet.getPeriodType().getName() ); List
sectionList = new ArrayList
(); @@ -196,6 +199,10 @@ { return "INVALID_PERIOD"; } + + if (isDataSetLocked(unit, dataSet, selectedPeriod)){ + return "DATASET_LOCKED"; + } Collection dataElements = dataSet.getDataElements(); Collection dataElementIds = new ArrayList( dataSetValue.getDataValues().size() ); @@ -228,6 +235,13 @@ // Supportive method // ------------------------------------------------------------------------- + private boolean isDataSetLocked(OrganisationUnit unit, org.hisp.dhis.dataset.DataSet dataSet, Period selectedPeriod){ + if(dataSetLockService.getDataSetLockByDataSetPeriodAndSource( dataSet, selectedPeriod, unit )!=null) + return true; + return false; + } + + private void saveDataValues( DataSetValue dataSetValue, Map dataElementMap, Period period, OrganisationUnit orgUnit, DataElementCategoryOptionCombo optionCombo ) @@ -266,9 +280,12 @@ } else { + if ( value != null ) + { dataValue.setValue( value ); dataValue.setTimestamp( new Date() ); dataValueService.updateDataValue( dataValue ); + } } } @@ -327,5 +344,13 @@ { this.i18nService = i18nService; } + + @Required + public void setDataSetLockService( org.hisp.dhis.datalock.DataSetLockService dataSetLockService ) + { + this.dataSetLockService = dataSetLockService; + } + + } === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-api/src/main/resources/META-INF/dhis/beans.xml 2010-11-26 11:00:40 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/resources/META-INF/dhis/beans.xml 2010-12-01 07:03:19 +0000 @@ -26,6 +26,7 @@ +