← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6611: Import of OptionSet, OrganisationUnit, OrganisationUnitGroup and OrganisationUnitGroupSet working...

 

------------------------------------------------------------
revno: 6611
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-04-17 11:04:52 +0300
message:
  Import of OptionSet, OrganisationUnit, OrganisationUnitGroup and OrganisationUnitGroupSet working. Also other minor changes.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseNameableObject.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/Mergeable.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/option/OptionSet.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroup.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleGroup.java
  dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java
  dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultImporter.java
  dhis-2/dhis-dxf2/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/IdentityPopulator.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/option/hibernate/OptionSet.hbm.xml
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ReflectionUtils.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/common/BaseIdentifiableObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java	2012-04-14 16:36:44 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java	2012-04-17 08:04:52 +0000
@@ -122,7 +122,7 @@
     // -------------------------------------------------------------------------
 
     @JsonProperty( value = "internalId" )
-    @JsonView( {DetailedView.class, IdentifiableObjectView.class, ExportView.class} )
+    @JsonView( {DetailedView.class, IdentifiableObjectView.class, ExportView.class } )
     @JacksonXmlProperty( isAttribute = true )
     public int getId()
     {
@@ -309,7 +309,10 @@
     {
         Validate.notNull( other );
 
-        this.id = other.getId() == 0 ? this.id : other.getId();
+        // since we are using these objects as db objects, i don't really think we want to "merge"
+        // with other.id, since .id is used by the underlying db.
+        // this.id = other.getId() == 0 ? this.id : other.getId();
+
         this.uid = other.getUid() == null ? this.uid : other.getUid();
         this.name = other.getName() == null ? this.name : other.getName();
         this.code = other.getCode() == null ? this.code : other.getCode();

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseNameableObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseNameableObject.java	2012-04-14 16:20:11 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseNameableObject.java	2012-04-17 08:04:52 +0000
@@ -80,22 +80,16 @@
     {
     }
 
-    public BaseNameableObject( int id, String uuid, String name, String alternativeName, String shortName,
+    public BaseNameableObject( int id, String uid, String name, String alternativeName, String shortName,
                                String code, String description )
     {
-        super( id, uuid, name );
+        super( id, uid, name );
         this.alternativeName = alternativeName;
         this.shortName = shortName;
         this.code = code;
         this.description = description;
     }
 
-    @Override
-    public String toString()
-    {
-        return super.toString();
-    }
-
     @JsonProperty
     @JsonView( {DetailedView.class, ExportView.class} )
     @JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/Mergeable.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/Mergeable.java	2012-04-06 21:31:51 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/Mergeable.java	2012-04-17 08:04:52 +0000
@@ -28,6 +28,9 @@
  */
 
 /**
+ * This interface is for merging one object into another, this is to be used by code supporting
+ * hibernate which means that for merging associations, only the owning side will be updated.
+ *
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */
 public interface Mergeable<T>

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java	2012-04-13 10:38:21 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java	2012-04-17 08:04:52 +0000
@@ -488,26 +488,36 @@
             version = version != null ? version : dataSet.getVersion();
             expiryDays = dataSet.getExpiryDays();
 
+            dataElements.clear();
+
             for ( DataElement dataElement : dataSet.getDataElements() )
             {
                 addDataElement( dataElement );
             }
 
+            indicators.clear();
+
             for ( Indicator indicator : dataSet.getIndicators() )
             {
                 addIndicator( indicator );
             }
 
+            compulsoryDataElementOperands.clear();
+
             for ( DataElementOperand dataElementOperand : dataSet.getCompulsoryDataElementOperands() )
             {
                 compulsoryDataElementOperands.add( dataElementOperand );
             }
 
+            sources.clear();
+
             for ( OrganisationUnit organisationUnit : dataSet.getSources() )
             {
                 addOrganisationUnit( organisationUnit );
             }
 
+            sections.clear();
+
             for ( Section section : dataSet.getSections() )
             {
                 sections.add( section );

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/option/OptionSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/option/OptionSet.java	2012-03-19 14:58:46 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/option/OptionSet.java	2012-04-17 08:04:52 +0000
@@ -34,6 +34,7 @@
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
 import org.hisp.dhis.common.BaseIdentifiableObject;
 import org.hisp.dhis.common.Dxf2Namespace;
+import org.hisp.dhis.common.IdentifiableObject;
 import org.hisp.dhis.common.view.DetailedView;
 import org.hisp.dhis.common.view.ExportView;
 
@@ -94,8 +95,8 @@
 
     @JsonProperty
     @JsonView( {DetailedView.class, ExportView.class} )
-    @JacksonXmlElementWrapper( localName = "options" )
-    @JacksonXmlProperty( localName = "option" )
+    @JacksonXmlElementWrapper( localName = "options", namespace = Dxf2Namespace.NAMESPACE )
+    @JacksonXmlProperty( localName = "option", namespace = Dxf2Namespace.NAMESPACE )
     public List<String> getOptions()
     {
         return options;
@@ -116,4 +117,18 @@
         Matcher matcher = OPTION_PATTERN.matcher( option );
         return matcher.find() && matcher.groupCount() > 0 ? matcher.group( 1 ).replaceAll( "_", " " ) : null;
     }
+
+    @Override
+    public void mergeWith( IdentifiableObject other )
+    {
+        super.mergeWith( other );
+
+        if ( other.getClass().isInstance( other ) )
+        {
+            OptionSet optionSet = (OptionSet) other;
+
+            options.clear();
+            options.addAll( optionSet.getOptions() );
+        }
+    }
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java	2012-04-14 16:20:11 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java	2012-04-17 08:04:52 +0000
@@ -202,6 +202,16 @@
         organisationUnitGroup.getMembers().remove( this );
     }
 
+    public void removeAllOrganisationUnitGroups()
+    {
+        for ( OrganisationUnitGroup organisationUnitGroup : groups )
+        {
+            organisationUnitGroup.getMembers().remove( this );
+        }
+
+        groups.clear();
+    }
+
     public void addDataSet( DataSet dataSet )
     {
         dataSets.add( dataSet );
@@ -214,6 +224,16 @@
         dataSet.getSources().remove( this );
     }
 
+    public void removeAllDataSets()
+    {
+        for ( DataSet dataSet : dataSets )
+        {
+            dataSet.getSources().remove( this );
+        }
+
+        dataSets.clear();
+    }
+
     public void updateDataSets( Set<DataSet> updates )
     {
         for ( DataSet dataSet : new HashSet<DataSet>( dataSets ) )
@@ -242,6 +262,16 @@
         users.remove( user );
     }
 
+    public void removeAllUsers()
+    {
+        for ( User user : users )
+        {
+            user.getOrganisationUnits().remove( this );
+        }
+
+        users.clear();
+    }
+
     public List<OrganisationUnit> getSortedChildren()
     {
         List<OrganisationUnit> sortedChildren = new ArrayList<OrganisationUnit>( children );
@@ -867,29 +897,14 @@
             comment = organisationUnit.getComment() == null ? comment : organisationUnit.getComment();
             geoCode = organisationUnit.getGeoCode() == null ? geoCode : organisationUnit.getGeoCode();
             featureType = organisationUnit.getFeatureType() == null ? featureType : organisationUnit.getFeatureType();
-            coordinates = organisationUnit.getFeatureType() == null ? coordinates : organisationUnit.getCoordinates();
+            coordinates = organisationUnit.getCoordinates() == null ? coordinates : organisationUnit.getCoordinates();
             url = organisationUnit.getUrl() == null ? url : organisationUnit.getUrl();
             contactPerson = organisationUnit.getContactPerson() == null ? contactPerson : organisationUnit.getContactPerson();
             address = organisationUnit.getAddress() == null ? address : organisationUnit.getAddress();
             email = organisationUnit.getEmail() == null ? email : organisationUnit.getEmail();
             phoneNumber = organisationUnit.getPhoneNumber() == null ? phoneNumber : organisationUnit.getPhoneNumber();
             hasPatients = organisationUnit.isHasPatients();
-            parent = organisationUnit.getParent() == null ? parent : organisationUnit.getParent();
-
-            for ( DataSet dataSet : organisationUnit.getDataSets() )
-            {
-                addDataSet( dataSet );
-            }
-
-            for ( OrganisationUnitGroup organisationUnitGroup : organisationUnit.getGroups() )
-            {
-                addOrganisationUnitGroup( organisationUnitGroup );
-            }
-
-            for ( User user : organisationUnit.getUsers() )
-            {
-                addUser( user );
-            }
+            parent = organisationUnit.getParent();
         }
     }
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroup.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroup.java	2012-04-14 16:20:11 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroup.java	2012-04-17 08:04:52 +0000
@@ -100,6 +100,16 @@
         organisationUnit.getGroups().remove( this );
     }
 
+    public void removeAllOrganisationUnits()
+    {
+        for ( OrganisationUnit organisationUnit : members )
+        {
+            organisationUnit.getGroups().remove( this );
+        }
+
+        members.clear();
+    }
+
     public void updateOrganisationUnits( Set<OrganisationUnit> updates )
     {
         for ( OrganisationUnit unit : new HashSet<OrganisationUnit>( members ) )
@@ -143,14 +153,16 @@
         return name.equals( other.getName() );
     }
 
+/*
     @Override
     public String toString()
     {
         return "OrganisationUnitGroup{" +
             "members=" + members +
-            ", groupSet=" + groupSet +
+            ", groupSet=" + groupSet.getName() +
             "} " + super.toString();
     }
+*/
 
     // -------------------------------------------------------------------------
     // Getters and setters
@@ -194,7 +206,7 @@
         {
             OrganisationUnitGroup organisationUnitGroup = (OrganisationUnitGroup) other;
 
-            groupSet = groupSet != null ? groupSet : organisationUnitGroup.getGroupSet();
+            removeAllOrganisationUnits();
 
             for ( OrganisationUnit organisationUnit : organisationUnitGroup.getMembers() )
             {

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java	2012-04-14 16:20:11 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java	2012-04-17 08:04:52 +0000
@@ -93,6 +93,16 @@
         organisationUnitGroup.setGroupSet( null );
     }
 
+    public void removeAllOrganisationUnitGroups()
+    {
+        for ( OrganisationUnitGroup organisationUnitGroup : organisationUnitGroups )
+        {
+            organisationUnitGroup.setGroupSet( null );
+        }
+
+        organisationUnitGroups.clear();
+    }
+
     public Collection<OrganisationUnit> getOrganisationUnits()
     {
         List<OrganisationUnit> units = new ArrayList<OrganisationUnit>();
@@ -172,6 +182,7 @@
         return name.equals( other.getName() );
     }
 
+/*
     @Override
     public String toString()
     {
@@ -181,6 +192,7 @@
             ", compulsory=" + compulsory +
             "} " + super.toString();
     }
+*/
 
     // -------------------------------------------------------------------------
     // Getters and setters
@@ -239,6 +251,8 @@
             compulsory = organisationUnitGroupSet.isCompulsory();
             description = organisationUnitGroupSet.getDescription() == null ? description : organisationUnitGroupSet.getDescription();
 
+            removeAllOrganisationUnitGroups();
+
             for ( OrganisationUnitGroup organisationUnitGroup : organisationUnitGroupSet.getOrganisationUnitGroups() )
             {
                 organisationUnitGroups.add( organisationUnitGroup );

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleGroup.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleGroup.java	2012-04-11 04:56:20 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleGroup.java	2012-04-17 08:04:52 +0000
@@ -166,6 +166,7 @@
             ValidationRuleGroup validationRuleGroup = (ValidationRuleGroup) other;
 
             description = validationRuleGroup.getDescription() == null ? description : validationRuleGroup.getDescription();
+            members.clear();
 
             for ( ValidationRule validationRule : validationRuleGroup.getMembers() )
             {

=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java	2012-04-14 16:20:11 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultImportService.java	2012-04-17 08:04:52 +0000
@@ -29,7 +29,6 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.hisp.dhis.common.IdentifiableObject;
 import org.hisp.dhis.dxf2.importsummary.ImportConflict;
 import org.hisp.dhis.dxf2.importsummary.ImportCount;
 import org.hisp.dhis.dxf2.importsummary.ImportSummary;
@@ -39,7 +38,6 @@
 
 import java.util.HashSet;
 import java.util.List;
-import java.util.Map;
 import java.util.Set;
 
 /**
@@ -82,7 +80,11 @@
         doImport( metaData.getConstants(), importOptions, importSummary );
         doImport( metaData.getDocuments(), importOptions, importSummary );
         doImport( metaData.getAttributeTypes(), importOptions, importSummary );
+*/
+
         doImport( metaData.getOptionSets(), importOptions, importSummary );
+
+/*
         doImport( metaData.getCategories(), importOptions, importSummary );
         doImport( metaData.getCategoryCombos(), importOptions, importSummary );
         doImport( metaData.getCategoryOptions(), importOptions, importSummary );
@@ -103,9 +105,9 @@
 
         doImport( metaData.getOrganisationUnits(), importOptions, importSummary );
         doImport( metaData.getOrganisationUnitGroups(), importOptions, importSummary );
-
-/*
         doImport( metaData.getOrganisationUnitGroupSets(), importOptions, importSummary );
+
+/*
         doImport( metaData.getSqlViews(), importOptions, importSummary );
         doImport( metaData.getUsers(), importOptions, importSummary );
         doImport( metaData.getUserGroups(), importOptions, importSummary );
@@ -137,7 +139,7 @@
 
     private <T> Importer<T> findImporterClass( Class<?> clazz )
     {
-        for ( Importer<T> i : importerClasses )
+        for ( Importer i : importerClasses )
         {
             if ( i.canHandle( clazz ) )
             {

=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultImporter.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultImporter.java	2012-04-14 16:20:11 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultImporter.java	2012-04-17 08:04:52 +0000
@@ -40,7 +40,6 @@
 import org.springframework.beans.factory.annotation.Autowired;
 
 import java.lang.reflect.Field;
-import java.lang.reflect.Method;
 import java.util.*;
 
 /**
@@ -119,14 +118,18 @@
             return null;
         }
 
+        // make sure that the internalId is 0, so that the system will generate a ID
+        object.setId( 0 );
+        object.setUid( CodeGenerator.generateCode() );
+
         log.info( "Trying to save new object with UID: " + object.getUid() );
 
         saveOrUpdateObjectWithReferences( object, false );
+
         manager.update( object );
         updateIdMaps( object );
 
         log.info( "Save successful." );
-
         log.info( object );
 
         return null;
@@ -150,12 +153,12 @@
         log.info( "Starting update of object " + getDisplayName( oldObject ) + " (" + oldObject.getClass().getSimpleName() + ")" );
 
         saveOrUpdateObjectWithReferences( object, true );
+
         oldObject.mergeWith( object );
         manager.update( oldObject );
 
         log.info( "Update successful." );
-
-        log.info( object );
+        log.info( oldObject );
 
         return null;
     }
@@ -246,18 +249,6 @@
         }
     }
 
-    protected void prepareIdentifiableObject( BaseIdentifiableObject object )
-    {
-        if ( object.getUid() == null && object.getLastUpdated() == null )
-        {
-            object.setAutoFields();
-        }
-        else if ( object.getUid() == null )
-        {
-            object.setUid( CodeGenerator.generateCode() );
-        }
-    }
-
     /**
      * @param object Object to get display name for
      * @return A usable display name
@@ -335,7 +326,6 @@
 
         if ( ImportStrategy.NEW.equals( options.getImportStrategy() ) )
         {
-            prepareIdentifiableObject( object );
             conflict = newObject( object, options );
 
             if ( conflict != null )
@@ -371,7 +361,6 @@
             }
             else
             {
-                prepareIdentifiableObject( object );
                 conflict = newObject( object, options );
 
                 if ( conflict != null )
@@ -574,6 +563,7 @@
         return matchedObject;
     }
 
+    // FIXME slow! some kind of global idMap would be needed here, that will also update itself from several importers
     private IdentifiableObject findObjectByReference( IdentifiableObject identifiableObject )
     {
         IdentifiableObject match = null;

=== modified file 'dhis-2/dhis-dxf2/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-dxf2/src/main/resources/META-INF/dhis/beans.xml	2012-04-13 14:11:00 +0000
+++ dhis-2/dhis-dxf2/src/main/resources/META-INF/dhis/beans.xml	2012-04-17 08:04:52 +0000
@@ -14,135 +14,147 @@
   <!-- register importers -->
 
   <bean id="attributeTypeImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultImporter">
-    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.attribute.Attribute"/>
+    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.attribute.Attribute" />
+  </bean>
+
+  <bean id="optionSetImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultImporter">
+    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.option.OptionSet" />
   </bean>
 
   <bean id="categoryImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultImporter">
-    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.dataelement.DataElementCategory"/>
+    <constructor-arg name="importerClass" type="java.lang.Class"
+        value="org.hisp.dhis.dataelement.DataElementCategory" />
   </bean>
 
   <bean id="categoryComboImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultImporter">
-    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.dataelement.DataElementCategoryCombo"/>
+    <constructor-arg name="importerClass" type="java.lang.Class"
+        value="org.hisp.dhis.dataelement.DataElementCategoryCombo" />
   </bean>
 
   <bean id="categoryOptionImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultImporter">
-    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.dataelement.DataElementCategoryOption"/>
+    <constructor-arg name="importerClass" type="java.lang.Class"
+        value="org.hisp.dhis.dataelement.DataElementCategoryOption" />
   </bean>
 
   <bean id="categoryOptionComboImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultImporter">
-    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.dataelement.DataElementCategoryOptionCombo"/>
+    <constructor-arg name="importerClass" type="java.lang.Class"
+        value="org.hisp.dhis.dataelement.DataElementCategoryOptionCombo" />
   </bean>
 
   <bean id="dataElementImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultImporter">
-    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.dataelement.DataElement"/>
+    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.dataelement.DataElement" />
   </bean>
 
   <bean id="dataElementGroupImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultImporter">
-    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.dataelement.DataElementGroup"/>
+    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.dataelement.DataElementGroup" />
   </bean>
 
   <bean id="dataElementGroupSetImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultImporter">
-    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.dataelement.DataElementGroupSet"/>
+    <constructor-arg name="importerClass" type="java.lang.Class"
+        value="org.hisp.dhis.dataelement.DataElementGroupSet" />
   </bean>
 
   <bean id="chartImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultImporter">
-    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.chart.Chart"/>
+    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.chart.Chart" />
   </bean>
 
   <bean id="conceptImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultImporter">
-    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.concept.Concept"/>
+    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.concept.Concept" />
   </bean>
 
   <bean id="constantImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultImporter">
-    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.constant.Constant"/>
+    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.constant.Constant" />
   </bean>
 
   <bean id="dataSetImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultImporter">
-    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.dataset.DataSet"/>
+    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.dataset.DataSet" />
   </bean>
 
   <bean id="documentImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultImporter">
-    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.document.Document"/>
+    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.document.Document" />
   </bean>
 
   <bean id="indicatorImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultImporter">
-    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.indicator.Indicator"/>
+    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.indicator.Indicator" />
   </bean>
 
   <bean id="indicatorTypeImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultImporter">
-    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.indicator.IndicatorType"/>
+    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.indicator.IndicatorType" />
   </bean>
 
   <bean id="indicatorGroupImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultImporter">
-    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.indicator.IndicatorGroup"/>
+    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.indicator.IndicatorGroup" />
   </bean>
 
   <bean id="indicatorGroupSetImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultImporter">
-    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.indicator.IndicatorGroupSet"/>
+    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.indicator.IndicatorGroupSet" />
   </bean>
 
   <bean id="mapViewImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultImporter">
-    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.mapping.MapView"/>
+    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.mapping.MapView" />
   </bean>
 
   <bean id="mapLegendImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultImporter">
-    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.mapping.MapLegend"/>
+    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.mapping.MapLegend" />
   </bean>
 
   <bean id="mapLegendSetImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultImporter">
-    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.mapping.MapLegendSet"/>
+    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.mapping.MapLegendSet" />
   </bean>
 
   <bean id="mapLayerImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultImporter">
-    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.mapping.MapLayer"/>
+    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.mapping.MapLayer" />
   </bean>
 
   <bean id="messageConversationImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultImporter">
-    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.message.MessageConversation"/>
+    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.message.MessageConversation" />
   </bean>
 
   <bean id="organisationUnitImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultImporter">
-    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.organisationunit.OrganisationUnit"/>
+    <constructor-arg name="importerClass" type="java.lang.Class"
+        value="org.hisp.dhis.organisationunit.OrganisationUnit" />
   </bean>
 
   <bean id="organisationUnitGroupImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultImporter">
-    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.organisationunit.OrganisationUnitGroup"/>
+    <constructor-arg name="importerClass" type="java.lang.Class"
+        value="org.hisp.dhis.organisationunit.OrganisationUnitGroup" />
   </bean>
 
   <bean id="organisationUnitGroupSetImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultImporter">
-    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.organisationunit.OrganisationUnitGroupSet"/>
+    <constructor-arg name="importerClass" type="java.lang.Class"
+        value="org.hisp.dhis.organisationunit.OrganisationUnitGroupSet" />
   </bean>
 
   <bean id="reportImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultImporter">
-    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.report.Report"/>
+    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.report.Report" />
   </bean>
 
   <bean id="reportTableImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultImporter">
-    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.reporttable.ReportTable"/>
+    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.reporttable.ReportTable" />
   </bean>
 
   <bean id="sqlViewImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultImporter">
-    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.sqlview.SqlView"/>
+    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.sqlview.SqlView" />
   </bean>
 
   <bean id="userImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultImporter">
-    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.user.User"/>
+    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.user.User" />
   </bean>
 
   <bean id="userGroupImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultImporter">
-    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.user.UserGroup"/>
+    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.user.UserGroup" />
   </bean>
 
   <bean id="userAuthorityGroupImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultImporter">
-    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.user.UserAuthorityGroup"/>
+    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.user.UserAuthorityGroup" />
   </bean>
 
   <bean id="validationRuleImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultImporter">
-    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.validation.ValidationRule"/>
+    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.validation.ValidationRule" />
   </bean>
 
   <bean id="validationRuleGroupImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultImporter">
-    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.validation.ValidationRuleGroup"/>
+    <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.validation.ValidationRuleGroup" />
   </bean>
 
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/IdentityPopulator.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/IdentityPopulator.java	2012-04-13 10:38:21 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/IdentityPopulator.java	2012-04-17 08:04:52 +0000
@@ -50,7 +50,7 @@
         "organisationunit", "orgunitgroup", "orgunitgroupset", "dataelementcategoryoption", "dataelementgroup", "sqlview",
         "dataelement", "dataelementgroupset", "dataelementcategory", "categorycombo", "categoryoptioncombo", "mapview",
         "reporttable", "report", "messageconversation", "message", "userinfo", "usergroup", "userrole", "maplegend",
-        "maplegendset", "maplayer", "section"
+        "maplegendset", "maplayer", "section", "optionset"
     };
 
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/option/hibernate/OptionSet.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/option/hibernate/OptionSet.hbm.xml	2012-02-12 19:37:55 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/option/hibernate/OptionSet.hbm.xml	2012-04-17 08:04:52 +0000
@@ -1,9 +1,9 @@
 <?xml version="1.0"?>
 <!DOCTYPE hibernate-mapping PUBLIC
-  "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
-  "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd";
-  [<!ENTITY identifiableProperties SYSTEM "classpath://org/hisp/dhis/common/identifiableProperties.hbm">]
->
+    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+    "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd";
+    [<!ENTITY identifiableProperties SYSTEM "classpath://org/hisp/dhis/common/identifiableProperties.hbm">]
+    >
 
 <hibernate-mapping>
   <class name="org.hisp.dhis.option.OptionSet" table="optionset">
@@ -14,13 +14,13 @@
       <generator class="native" />
     </id>
     &identifiableProperties;
-    
+
     <list name="options" table="optionsetmembers">
-	  <cache usage="read-write" />
-	  <key column="optionsetid" foreign-key="fk_optionsetmembers_optionsetid" />
-	  <list-index column="sort_order" />
-	  <element type="text" column="optionvalue"/>
-	</list>
-    
+      <cache usage="read-write" />
+      <key column="optionsetid" foreign-key="fk_optionsetmembers_optionsetid" />
+      <list-index column="sort_order" />
+      <element type="text" column="optionvalue" />
+    </list>
+
   </class>
 </hibernate-mapping>

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ReflectionUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ReflectionUtils.java	2012-04-14 16:36:44 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ReflectionUtils.java	2012-04-17 08:04:52 +0000
@@ -227,7 +227,7 @@
             {
                 Field field = object.getClass().getDeclaredField( fieldName );
                 method = findSetterMethod( fieldName, object, field.getType() );
-            } catch ( NoSuchFieldException e )
+            } catch ( NoSuchFieldException ignored )
             {
             }
         }
@@ -244,7 +244,6 @@
     public static <T> T invokeGetterMethod( String fieldName, Object object )
     {
         Method method = findGetterMethod( fieldName, object );
-        log.info( method );
 
         if ( method == null )
         {
@@ -269,7 +268,6 @@
     public static <T> T invokeSetterMethod( String fieldName, Object object, Object... objects )
     {
         Method method = findSetterMethod( fieldName, object );
-        log.info( method );
 
         if ( method == null )
         {