dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #03411
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1146: Fixed a bug with the CategoryComboDeletionHandler
------------------------------------------------------------
revno: 1146
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Tue 2009-12-01 12:11:16 +0100
message:
Fixed a bug with the CategoryComboDeletionHandler
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementDeletionHandler.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
--
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-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementDeletionHandler.java 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DataElementDeletionHandler.java 2009-12-01 11:11:16 +0000
@@ -28,6 +28,7 @@
*/
import org.hisp.dhis.system.deletion.DeletionHandler;
+import static org.hisp.dhis.dataelement.DataElementCategoryCombo.DEFAULT_CATEGORY_COMBO_NAME;
/**
* @author Lars Helge Overland
@@ -47,6 +48,13 @@
this.dataElementService = dataElementService;
}
+ private DataElementCategoryService categoryService;
+
+ public void setCategoryService( DataElementCategoryService categoryService )
+ {
+ this.categoryService = categoryService;
+ }
+
// -------------------------------------------------------------------------
// DeletionHandler implementation
// -------------------------------------------------------------------------
@@ -60,11 +68,13 @@
@Override
public void deleteDataElementCategoryCombo( DataElementCategoryCombo categoryCombo )
{
+ DataElementCategoryCombo default_ = categoryService.getDataElementCategoryComboByName( DEFAULT_CATEGORY_COMBO_NAME );
+
for ( DataElement dataElement : dataElementService.getAllDataElements() )
{
if ( dataElement.getCategoryCombo().equals( categoryCombo ) )
{
- dataElement.setCategoryCombo( null );
+ dataElement.setCategoryCombo( default_ );
dataElementService.updateDataElement( dataElement );
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2009-11-16 10:32:46 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2009-12-01 11:11:16 +0000
@@ -415,6 +415,8 @@
class="org.hisp.dhis.dataelement.DataElementDeletionHandler">
<property name="dataElementService"
ref="org.hisp.dhis.dataelement.DataElementService"/>
+ <property name="categoryService"
+ ref="org.hisp.dhis.dataelement.DataElementCategoryService"/>
</bean>
<bean id="org.hisp.dhis.dataelement.DataElementGroupDeletionHandler"