dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #01448
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 449: Fixed bug related to edit dataset.
------------------------------------------------------------
revno: 449
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Thu 2009-07-09 01:48:39 +0200
message:
Fixed bug related to edit dataset.
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java 2009-07-08 23:48:39 +0000
@@ -35,6 +35,7 @@
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetService;
import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.period.PeriodType;
import com.opensymphony.xwork.Action;
@@ -125,7 +126,7 @@
if ( shortName != null && shortName.trim().length() == 0 )
{
- shortName = null;
+ shortName = null;
}
if ( code != null && code.trim().length() == 0 )
@@ -133,25 +134,22 @@
code = null;
}
+ Collection<DataElement> dataElements = new HashSet<DataElement>();
+
+ for ( String id : selectedList )
+ {
+ dataElements.add( dataElementService.getDataElement( Integer.parseInt( id ) ) );
+ }
+
+ PeriodType periodType = periodService.getPeriodTypeByName( frequencySelect );
+
DataSet dataSet = dataSetService.getDataSet( dataSetId );
dataSet.setName( name );
dataSet.setShortName( shortName );
dataSet.setCode( code );
- dataSet.setPeriodType( periodService.getPeriodTypeByName( frequencySelect ) );
-
- Collection<DataElement> updatedDataElementList = new HashSet<DataElement>();
-
- for ( String id : selectedList )
- {
- DataElement dataElement = dataElementService.getDataElement( Integer.parseInt( id ) );
-
- updatedDataElementList.add( dataElement );
- }
-
- dataSet.getDataElements().retainAll( updatedDataElementList );
-
- dataSet.getDataElements().addAll( updatedDataElementList );
+ dataSet.setPeriodType( periodService.getPeriodTypeByClass( periodType.getClass() ) );
+ dataSet.setDataElements( dataElements );
dataSetService.updateDataSet( dataSet );
--
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.