← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22267: set default UID/code for auto-generated default categories (when starting on empty database)

 

------------------------------------------------------------
revno: 22267
committer: Morten Olav Hansen <morten@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2016-03-13 13:34:16 +0700
message:
  set default UID/code for auto-generated default categories (when starting on empty database)
modified:
  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-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	2016-03-07 20:57:57 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java	2016-03-13 06:34:16 +0000
@@ -612,8 +612,9 @@
         // DataElementCategoryOption
         // ---------------------------------------------------------------------
 
-        DataElementCategoryOption categoryOption = new DataElementCategoryOption(
-            DataElementCategoryOption.DEFAULT_NAME );
+        DataElementCategoryOption categoryOption = new DataElementCategoryOption( DataElementCategoryOption.DEFAULT_NAME );
+        categoryOption.setUid( "xYerKDKCefk" );
+        categoryOption.setCode( "default" );
 
         addDataElementCategoryOption( categoryOption );
 
@@ -622,6 +623,9 @@
         // ---------------------------------------------------------------------
 
         DataElementCategory category = new DataElementCategory( DataElementCategory.DEFAULT_NAME );
+        category.setUid( "GLevLNI9wkl" );
+        category.setCode( "default" );
+
         category.addCategoryOption( categoryOption );
         addDataElementCategory( category );
 
@@ -629,8 +633,10 @@
         // DataElementCategoryCombo
         // ---------------------------------------------------------------------
 
-        DataElementCategoryCombo categoryCombo = new DataElementCategoryCombo(
-            DataElementCategoryCombo.DEFAULT_CATEGORY_COMBO_NAME );
+        DataElementCategoryCombo categoryCombo = new DataElementCategoryCombo( DataElementCategoryCombo.DEFAULT_CATEGORY_COMBO_NAME );
+        categoryCombo.setUid( "bjDvmb4bfuf" );
+        categoryCombo.setCode( "default" );
+
         categoryCombo.addDataElementCategory( category );
         addDataElementCategoryCombo( categoryCombo );
 
@@ -639,6 +645,8 @@
         // ---------------------------------------------------------------------
 
         DataElementCategoryOptionCombo categoryOptionCombo = new DataElementCategoryOptionCombo();
+        categoryOptionCombo.setUid( "HllvX50cXC0" );
+        categoryOptionCombo.setCode( "default" );
 
         categoryOptionCombo.setCategoryCombo( categoryCombo );
         categoryOptionCombo.addDataElementCategoryOption( categoryOption );
@@ -697,7 +705,7 @@
             log.warn( "Category combo is null or invalid, could not update option combos: " + categoryCombo );
             return;
         }
-        
+
         List<DataElementCategoryOptionCombo> generatedOptionCombos = categoryCombo.generateOptionCombosList();
         Set<DataElementCategoryOptionCombo> persistedOptionCombos = categoryCombo.getOptionCombos();
 
@@ -1048,5 +1056,5 @@
     public int getCategoryOptionGroupSetCountByName( String name )
     {
         return categoryOptionGroupSetStore.getCountLikeName( name );
-    }    
+    }
 }