=== 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 2011-01-06 13:33:29 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java 2011-02-15 06:38:47 +0000 @@ -254,6 +254,11 @@ public int addDataElementCategoryOptionCombo( DataElementCategoryOptionCombo dataElementCategoryOptionCombo ) { + if ( dataElementCategoryOptionCombo != null && dataElementCategoryOptionCombo.getUuid() == null ) + { + dataElementCategoryOptionCombo.setUuid( UUIdUtils.getUUId() ); + } + return dataElementCategoryOptionComboStore.save( dataElementCategoryOptionCombo ); } === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/UuidPopulator.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/UuidPopulator.java 2010-04-12 21:23:33 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/UuidPopulator.java 2011-02-15 06:38:47 +0000 @@ -31,12 +31,18 @@ import org.apache.commons.logging.LogFactory; import org.hisp.dhis.system.startup.AbstractStartupRoutine; import org.hisp.dhis.system.util.UUIdUtils; +import org.springframework.transaction.annotation.Transactional; /** * @author Bob Jolliffe * @version $Id$ * * Provides uuids to uniquely indentifiable objects which do not already have them. + * + *
Should be all the things requiring uuids .. there are more.
+ * What follows is a bit of a compromise hack essentially copying
+ * and pasting 3 times. Should reimplement with common interface
+ * IdentifiableObject or something similar.
*/
public class UuidPopulator
extends AbstractStartupRoutine
@@ -47,11 +53,6 @@
// Dependencies
// -------------------------------------------------------------------------
- // Should be all the things requiring uuids .. there are more.
- // What follows is a bit of a compromise hack essentially copying
- // and pasting 3 times. Should reimplement with common interface
- // IdentifiableObject or something similar.
-
private DataElementCategoryService categoryService;
private DataElementService dataElementService;
@@ -70,6 +71,7 @@
// StartupRoutine implementation
// -------------------------------------------------------------------------
+ @Transactional
public void execute()
throws Exception
{
@@ -108,5 +110,17 @@
}
}
log.info( "Checked DataElement uuids" );
+
+ for ( DataElementCategoryOptionCombo combo : categoryService.getAllDataElementCategoryOptionCombos() )
+ {
+ if ( combo.getUuid() == null )
+ {
+ combo.setUuid( UUIdUtils.getUUId() );
+ categoryService.updateDataElementCategoryOptionCombo( combo );
+ log.info( "Added uuid for CategoryOptionCombo '" + combo.getName() + "'" );
+ }
+ }
+ log.info( "Checked CategoryOptionCombo uuids" );
+
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOptionCombo.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOptionCombo.hbm.xml 2011-01-07 11:38:55 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOptionCombo.hbm.xml 2011-02-15 06:38:47 +0000
@@ -10,6 +10,10 @@