dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #42518
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21735: Adding a hook for generating option combos when category combo is added or updated
------------------------------------------------------------
revno: 21735
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2016-01-14 17:39:01 +0100
message:
Adding a hook for generating option combos when category combo is added or updated
modified:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/dataelement/CategoryComboController.java
--
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-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/dataelement/CategoryComboController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/dataelement/CategoryComboController.java 2016-01-04 02:27:49 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/dataelement/CategoryComboController.java 2016-01-14 16:39:01 +0000
@@ -1,5 +1,7 @@
package org.hisp.dhis.webapi.controller.dataelement;
+import org.hisp.dhis.dataelement.DataElementCategory;
+
/*
* Copyright (c) 2004-2016, University of Oslo
* All rights reserved.
@@ -29,8 +31,10 @@
*/
import org.hisp.dhis.dataelement.DataElementCategoryCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.schema.descriptors.CategoryComboSchemaDescriptor;
import org.hisp.dhis.webapi.controller.AbstractCrudController;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -42,4 +46,17 @@
public class CategoryComboController
extends AbstractCrudController<DataElementCategoryCombo>
{
+ @Autowired
+ private DataElementCategoryService categoryService;
+
+ @Override
+ public void postCreateEntity( DataElementCategoryCombo categoryCombo )
+ {
+ categoryService.updateOptionCombos( categoryCombo );
+ }
+
+ public void postUpdateEntity( DataElementCategoryCombo categoryCombo )
+ {
+ categoryService.updateOptionCombos( categoryCombo );
+ }
}