← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19513: Implemented method to retrieve category by code

 

------------------------------------------------------------
revno: 19513
committer: Bob Jolliffe <bobjolliffe@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-06-24 11:36:42 +0100
message:
  Implemented method to retrieve category by code
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.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-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java	2015-06-16 05:11:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java	2015-06-24 10:36:42 +0000
@@ -124,6 +124,14 @@
     DataElementCategory getDataElementCategoryByName( String name );
 
     /**
+     * Retrieves the DataElementCategory with the given code.
+     * 
+     * @param code the name of the DataElementCategory to retrieve.
+     * @return the DataElementCategory.
+     */
+    DataElementCategory getDataElementCategoryByCode( String code );
+
+    /**
      * Returns all DataElementCategories.
      * 
      * @return a list of all DataElementCategories.

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java	2015-06-16 05:11:29 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java	2015-06-24 10:36:42 +0000
@@ -220,6 +220,12 @@
     }
 
     @Override
+    public DataElementCategory getDataElementCategoryByCode( String code )
+    {
+        return categoryStore.getByCode( code );
+    }
+
+    @Override
     public List<DataElementCategory> getDisaggregationCategories()
     {
         return i18n( i18nService, categoryStore.getCategoriesByDimensionType( DataElementCategoryCombo.DIMENSION_TYPE_DISAGGREGATION ) );