← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9943: more work on importer, dataEntryForm should be OK now, but needs more testing

 

------------------------------------------------------------
revno: 9943
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-03-01 17:18:31 +0700
message:
  more work on importer, dataEntryForm should be OK now, but needs more testing
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/expression/Expression.java
  dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java
  dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.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/DefaultIdentifiableObjectManager.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	2013-03-01 05:40:28 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseIdentifiableObject.java	2013-03-01 10:18:31 +0000
@@ -424,6 +424,7 @@
             ", name='" + name + '\'' +
             ", created=" + created +
             ", lastUpdated=" + lastUpdated +
+            ", class=" + getClass().getSimpleName() +
             '}';
     }
 

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java	2013-02-25 12:33:35 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java	2013-03-01 10:18:31 +0000
@@ -177,6 +177,12 @@
     // Getters and setters
     // ------------------------------------------------------------------------
 
+    @Override
+    public boolean isAutoGenerated()
+    {
+        return name != null && name.equals( DEFAULT_NAME );
+    }
+
     @JsonProperty
     @JsonSerialize( contentAs = BaseIdentifiableObject.class )
     @JsonView( {DetailedView.class, ExportView.class} )

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java	2013-02-13 03:57:52 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryCombo.java	2013-03-01 10:18:31 +0000
@@ -41,12 +41,16 @@
 import org.hisp.dhis.common.view.DetailedView;
 import org.hisp.dhis.common.view.ExportView;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
 
 /**
  * @author Abyot Aselefew
  */
-@JacksonXmlRootElement( localName = "categoryCombo", namespace = DxfNamespaces.DXF_2_0)
+@JacksonXmlRootElement(localName = "categoryCombo", namespace = DxfNamespaces.DXF_2_0)
 public class DataElementCategoryCombo
     extends BaseIdentifiableObject
 {
@@ -70,7 +74,7 @@
     private Set<DataElementCategoryOptionCombo> optionCombos = new HashSet<DataElementCategoryOptionCombo>();
 
     private boolean skipTotal;
-    
+
     // -------------------------------------------------------------------------
     // Constructors
     // -------------------------------------------------------------------------
@@ -161,12 +165,13 @@
         CombinationGenerator<DataElementCategoryOption> generator =
             new CombinationGenerator<DataElementCategoryOption>( getCategoryOptionsAsArray() );
 
-        sortLoop : while ( generator.hasNext() )
+        sortLoop:
+        while ( generator.hasNext() )
         {
             List<DataElementCategoryOption> categoryOptions = generator.getNext();
-            
+
             Set<DataElementCategoryOption> categoryOptionSet = new HashSet<DataElementCategoryOption>( categoryOptions );
-            
+
             for ( DataElementCategoryOptionCombo optionCombo : optionCombos )
             {
                 if ( optionCombo.getCategoryOptions() != null && optionCombo.getCategoryOptions().equals( categoryOptionSet ) )
@@ -177,10 +182,10 @@
                 }
             }
         }
-        
+
         return list;
     }
-    
+
     private String getNameFromCategoryOptions( List<DataElementCategoryOption> categoryOptions )
     {
         StringBuilder name = new StringBuilder();
@@ -201,7 +206,7 @@
 
         return name.toString();
     }
-    
+
     //TODO update category option -> category option combo association
     public void generateOptionCombos()
     {
@@ -213,6 +218,12 @@
     // -------------------------------------------------------------------------
 
     @Override
+    public boolean isAutoGenerated()
+    {
+        return name != null && name.equals( DEFAULT_CATEGORY_COMBO_NAME );
+    }
+
+    @Override
     public int hashCode()
     {
         return name.hashCode();
@@ -271,10 +282,10 @@
     // -------------------------------------------------------------------------
 
     @JsonProperty
-    @JsonSerialize( contentAs = BaseIdentifiableObject.class )
-    @JsonView( {DetailedView.class, ExportView.class} )
-    @JacksonXmlElementWrapper( localName = "categories", namespace = DxfNamespaces.DXF_2_0)
-    @JacksonXmlProperty( localName = "category", namespace = DxfNamespaces.DXF_2_0)
+    @JsonSerialize(contentAs = BaseIdentifiableObject.class)
+    @JsonView({ DetailedView.class, ExportView.class })
+    @JacksonXmlElementWrapper(localName = "categories", namespace = DxfNamespaces.DXF_2_0)
+    @JacksonXmlProperty(localName = "category", namespace = DxfNamespaces.DXF_2_0)
     public List<DataElementCategory> getCategories()
     {
         return categories;
@@ -285,11 +296,11 @@
         this.categories = categories;
     }
 
-    @JsonProperty( value = "categoryOptionCombos" )
-    @JsonSerialize( contentAs = BaseIdentifiableObject.class )
-    @JsonView( {DetailedView.class} )
-    @JacksonXmlElementWrapper( localName = "categoryOptionCombos", namespace = DxfNamespaces.DXF_2_0)
-    @JacksonXmlProperty( localName = "categoryOptionCombo", namespace = DxfNamespaces.DXF_2_0)
+    @JsonProperty(value = "categoryOptionCombos")
+    @JsonSerialize(contentAs = BaseIdentifiableObject.class)
+    @JsonView({ DetailedView.class })
+    @JacksonXmlElementWrapper(localName = "categoryOptionCombos", namespace = DxfNamespaces.DXF_2_0)
+    @JacksonXmlProperty(localName = "categoryOptionCombo", namespace = DxfNamespaces.DXF_2_0)
     public Set<DataElementCategoryOptionCombo> getOptionCombos()
     {
         return optionCombos;
@@ -301,8 +312,8 @@
     }
 
     @JsonProperty
-    @JsonView( { DetailedView.class, ExportView.class } )
-    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0)
+    @JsonView({ DetailedView.class, ExportView.class })
+    @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0)
     public boolean isSkipTotal()
     {
         return skipTotal;

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java	2013-03-01 05:21:27 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java	2013-03-01 10:18:31 +0000
@@ -155,6 +155,12 @@
     }
 
     @Override
+    public boolean isAutoGenerated()
+    {
+        return name != null && name.equals( DEFAULT_NAME );
+    }
+
+    @Override
     @JsonIgnore
     public String getShortName()
     {

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java	2013-03-01 05:40:28 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionCombo.java	2013-03-01 10:18:31 +0000
@@ -302,7 +302,7 @@
     @Override
     public boolean isAutoGenerated()
     {
-        return isDefault();
+        return name != null && name.equals( DEFAULT_NAME );
     }
 
     @Override

=== 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	2013-02-28 15:20:20 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java	2013-03-01 10:18:31 +0000
@@ -437,11 +437,9 @@
         this.periodType = periodType;
     }
 
-    /*
     @JsonProperty
     @JsonView( { DetailedView.class, ExportView.class } )
     @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
-    */
     public DataEntryForm getDataEntryForm()
     {
         return dataEntryForm;
@@ -538,7 +536,7 @@
 
     @JsonProperty
     @JsonSerialize( contentAs = BaseIdentifiableObject.class )
-    @JsonView( { DetailedView.class, ExportView.class } )
+    @JsonView( { DetailedView.class } )
     @JacksonXmlElementWrapper( localName = "sections", namespace = DxfNamespaces.DXF_2_0 )
     @JacksonXmlProperty( localName = "section", namespace = DxfNamespaces.DXF_2_0 )
     public Set<Section> getSections()

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/expression/Expression.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/expression/Expression.java	2013-02-25 12:33:35 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/expression/Expression.java	2013-03-01 10:18:31 +0000
@@ -302,8 +302,10 @@
         expression = other.getExpression() == null ? expression : other.getExpression();
         description = other.getDescription() == null ? description : other.getDescription();
         nullIfBlank = other.isNullIfBlank();
+
         dataElementsInExpression = other.getDataElementsInExpression() == null ?
             dataElementsInExpression : new HashSet<DataElement>( other.getDataElementsInExpression() );
+
         optionCombosInExpression = other.getOptionCombosInExpression() == null ?
             optionCombosInExpression : new HashSet<DataElementCategoryOptionCombo>( other.getOptionCombosInExpression() );
     }

=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java	2013-02-28 15:20:20 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java	2013-03-01 10:18:31 +0000
@@ -176,6 +176,20 @@
                     {
                         nameMap.put( (Class<? extends IdentifiableObject>) clazz, map );
                     }
+                    else
+                    {
+                        // add an empty map here, since we could still have some auto-generated properties
+                        nameMap.put( (Class<? extends IdentifiableObject>) clazz, new HashMap<String, IdentifiableObject>() );
+
+                        // find all auto-generated props and add them
+                        for ( Map.Entry<String, IdentifiableObject> entry : map.entrySet() )
+                        {
+                            if ( entry.getValue().isAutoGenerated() )
+                            {
+                                nameMap.get( clazz ).put( entry.getKey(), entry.getValue() );
+                            }
+                        }
+                    }
                 }
                 catch ( InstantiationException ignored )
                 {
@@ -217,7 +231,7 @@
                 manager.save( (IdentifiableObject) object );
             }
 
-            // _updateInternalMaps( object );
+            _updateInternalMaps( object );
         }
         else
         {
@@ -350,7 +364,7 @@
                 }
             }
 
-            if ( identifiableObject.haveUniqueNames() && identifiableObject.getName() != null )
+            if ( (identifiableObject.haveUniqueNames() || identifiableObject.isAutoGenerated()) && identifiableObject.getName() != null )
             {
                 IdentifiableObject match = getNameMatch( identifiableObject );
 
@@ -396,7 +410,7 @@
                 map.put( identifiableObject.getCode(), identifiableObject );
             }
 
-            if ( identifiableObject.haveUniqueNames() && identifiableObject.getName() != null )
+            if ( (identifiableObject.haveUniqueNames() || identifiableObject.isAutoGenerated()) && identifiableObject.getName() != null )
             {
                 Map<String, IdentifiableObject> map = nameMap.get( identifiableObject.getClass() );
 

=== modified file 'dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java'
--- dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java	2013-02-28 15:20:20 +0000
+++ dhis-2/dhis-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/importers/DefaultIdentifiableObjectImporter.java	2013-03-01 10:18:31 +0000
@@ -158,7 +158,7 @@
                 deleteAttributeValues( object );
                 deleteExpression( object, "leftSide" );
                 deleteExpression( object, "rightSide" );
-                // deleteDataEntryForm( object, "dataEntryForm" );
+                deleteDataEntryForm( object, "dataEntryForm" );
                 // deleteDataElementOperands( idObject, "compulsoryDataElementOperands" );
                 deleteDataElementOperands( object, "greyedFields" );
 
@@ -171,7 +171,7 @@
             saveAttributeValues( object, attributeValues );
             saveExpression( object, "leftSide", leftSide );
             saveExpression( object, "rightSide", rightSide );
-            // saveDataEntryForm( object, "dataEntryForm", dataEntryForm );
+            saveDataEntryForm( object, "dataEntryForm", dataEntryForm );
             // saveDataElementOperands( idObject, "compulsoryDataElementOperands", compulsoryDataElementOperands );
             saveDataElementOperands( object, "greyedFields", greyedFields );
         }

=== 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	2013-02-28 05:17:00 +0000
+++ dhis-2/dhis-dxf2/src/main/resources/META-INF/dhis/beans.xml	2013-03-01 10:18:31 +0000
@@ -1,196 +1,195 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <beans xmlns="http://www.springframework.org/schema/beans"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
-    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd";>
-
-  <bean id="org.hisp.dhis.dxf2.metadata.ExportService" class="org.hisp.dhis.dxf2.metadata.DefaultExportService" />
-
-  <bean id="org.hisp.dhis.dxf2.metadata.ImportService" class="org.hisp.dhis.dxf2.metadata.DefaultImportService" />
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd";>
+
+  <bean id="org.hisp.dhis.dxf2.metadata.ExportService" class="org.hisp.dhis.dxf2.metadata.DefaultExportService" scope="prototype" />
+
+  <bean id="org.hisp.dhis.dxf2.metadata.ImportService" class="org.hisp.dhis.dxf2.metadata.DefaultImportService" scope="prototype" />
 
   <bean id="org.hisp.dhis.dxf2.metadata.ObjectBridge" class="org.hisp.dhis.dxf2.metadata.DefaultObjectBridge" />
 
   <bean id="org.hisp.dhis.dxf2.datavalueset.DataValueSetService"
-      class="org.hisp.dhis.dxf2.datavalueset.DefaultDataValueSetService" />
+    class="org.hisp.dhis.dxf2.datavalueset.DefaultDataValueSetService" />
 
   <bean id="org.hisp.dhis.dxf2.datavalueset.DataValueSetStore"
-      class="org.hisp.dhis.dxf2.datavalueset.SpringDataValueSetStore" />
+    class="org.hisp.dhis.dxf2.datavalueset.SpringDataValueSetStore" />
 
   <!-- register idObject handlers -->
 
   <bean id="organisationUnitObjectHandler"
-      class="org.hisp.dhis.dxf2.metadata.handlers.OrganisationUnitObjectHandler" scope="prototype"/>
+    class="org.hisp.dhis.dxf2.metadata.handlers.OrganisationUnitObjectHandler" scope="prototype" />
 
   <!-- register field handlers -->
 
   <!-- register importers -->
 
-  <bean id="attributeTypeImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter">
+  <bean id="attributeTypeImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <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.DefaultIdentifiableObjectImporter">
+  <bean id="optionSetImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <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.DefaultIdentifiableObjectImporter">
-    <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.DefaultIdentifiableObjectImporter">
-    <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.DefaultIdentifiableObjectImporter">
-    <constructor-arg name="importerClass" type="java.lang.Class"
-        value="org.hisp.dhis.dataelement.DataElementCategoryOption" />
+  <bean id="categoryImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
+    <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.DefaultIdentifiableObjectImporter" scope="prototype">
+    <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.DefaultIdentifiableObjectImporter" scope="prototype">
+    <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.DefaultIdentifiableObjectImporter">
+    class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <constructor-arg name="importerClass" type="java.lang.Class"
-        value="org.hisp.dhis.dataelement.DataElementCategoryOptionCombo" />
+      value="org.hisp.dhis.dataelement.DataElementCategoryOptionCombo" />
   </bean>
 
-  <bean id="dataElementImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter">
+  <bean id="dataElementImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <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.DefaultIdentifiableObjectImporter">
+  <bean id="dataElementGroupImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <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.DefaultIdentifiableObjectImporter">
+    class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <constructor-arg name="importerClass" type="java.lang.Class"
-        value="org.hisp.dhis.dataelement.DataElementGroupSet" />
+      value="org.hisp.dhis.dataelement.DataElementGroupSet" />
   </bean>
 
-  <bean id="chartImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter">
+  <bean id="chartImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <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.DefaultIdentifiableObjectImporter">
+  <bean id="conceptImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <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.DefaultIdentifiableObjectImporter">
+  <bean id="constantImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.constant.Constant" />
   </bean>
 
-  <bean id="sectionImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter">
+  <bean id="sectionImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.dataset.Section" />
   </bean>
 
-  <bean id="dataSetImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter">
+  <bean id="dataSetImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <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.DefaultIdentifiableObjectImporter">
+  <bean id="documentImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <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.DefaultIdentifiableObjectImporter">
+  <bean id="indicatorImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <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.DefaultIdentifiableObjectImporter">
+  <bean id="indicatorTypeImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <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.DefaultIdentifiableObjectImporter">
+  <bean id="indicatorGroupImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <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.DefaultIdentifiableObjectImporter">
+  <bean id="indicatorGroupSetImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.indicator.IndicatorGroupSet" />
   </bean>
 
-  <bean id="mapImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter">
+  <bean id="mapImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.mapping.Map" />
   </bean>
 
-  <bean id="mapViewImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter">
+  <bean id="mapViewImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <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.DefaultIdentifiableObjectImporter">
+  <bean id="mapLegendImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <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.DefaultIdentifiableObjectImporter">
+  <bean id="mapLegendSetImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <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.DefaultIdentifiableObjectImporter">
+  <bean id="mapLayerImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <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.DefaultIdentifiableObjectImporter">
+    class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <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.DefaultIdentifiableObjectImporter">
+  <bean id="organisationUnitImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <constructor-arg name="importerClass" type="java.lang.Class"
-        value="org.hisp.dhis.organisationunit.OrganisationUnit" />
+      value="org.hisp.dhis.organisationunit.OrganisationUnit" />
   </bean>
 
   <bean id="organisationUnitLevelImporter"
-      class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter">
+    class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <constructor-arg name="importerClass" type="java.lang.Class"
-        value="org.hisp.dhis.organisationunit.OrganisationUnitLevel" />
+      value="org.hisp.dhis.organisationunit.OrganisationUnitLevel" />
   </bean>
 
   <bean id="organisationUnitGroupImporter"
-      class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter">
+    class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <constructor-arg name="importerClass" type="java.lang.Class"
-        value="org.hisp.dhis.organisationunit.OrganisationUnitGroup" />
+      value="org.hisp.dhis.organisationunit.OrganisationUnitGroup" />
   </bean>
 
   <bean id="organisationUnitGroupSetImporter"
-      class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter">
+    class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <constructor-arg name="importerClass" type="java.lang.Class"
-        value="org.hisp.dhis.organisationunit.OrganisationUnitGroupSet" />
+      value="org.hisp.dhis.organisationunit.OrganisationUnitGroupSet" />
   </bean>
 
-  <bean id="reportImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter">
+  <bean id="reportImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <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.DefaultIdentifiableObjectImporter">
+  <bean id="reportTableImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <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.DefaultIdentifiableObjectImporter">
+  <bean id="sqlViewImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <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.DefaultIdentifiableObjectImporter">
+  <bean id="userImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <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.DefaultIdentifiableObjectImporter">
+  <bean id="userGroupImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <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.DefaultIdentifiableObjectImporter">
+  <bean id="userAuthorityGroupImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <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.DefaultIdentifiableObjectImporter">
+  <bean id="validationRuleImporter" class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <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.DefaultIdentifiableObjectImporter">
+    class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.validation.ValidationRuleGroup" />
   </bean>
 
   <bean id="dataDictionaryImporter"
-      class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter">
+    class="org.hisp.dhis.dxf2.metadata.importers.DefaultIdentifiableObjectImporter" scope="prototype">
     <constructor-arg name="importerClass" type="java.lang.Class" value="org.hisp.dhis.datadictionary.DataDictionary" />
   </bean>
 
-
 </beans>

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java	2013-02-28 15:20:20 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java	2013-03-01 10:18:31 +0000
@@ -487,7 +487,7 @@
     //--------------------------------------------------------------------------
 
     @Override
-    @SuppressWarnings( "unchecked" )
+    @SuppressWarnings("unchecked")
     public <T extends IdentifiableObject> List<T> getAllAccessible( Class<T> clazz )
     {
         User user = currentUserService.getCurrentUser();
@@ -503,7 +503,7 @@
     }
 
     @Override
-    @SuppressWarnings( "unchecked" )
+    @SuppressWarnings("unchecked")
     public <T extends IdentifiableObject> List<T> getAccessibleLikeName( Class<T> clazz, String name )
     {
         User user = currentUserService.getCurrentUser();
@@ -519,7 +519,7 @@
     }
 
     @Override
-    @SuppressWarnings( "unchecked" )
+    @SuppressWarnings("unchecked")
     public <T extends IdentifiableObject> List<T> getAccessibleBetween( Class<T> clazz, int first, int max )
     {
         User user = currentUserService.getCurrentUser();
@@ -535,7 +535,7 @@
     }
 
     @Override
-    @SuppressWarnings( "unchecked" )
+    @SuppressWarnings("unchecked")
     public <T extends IdentifiableObject> List<T> getAccessibleBetweenLikeName( Class<T> clazz, String name, int first, int max )
     {
         User user = currentUserService.getCurrentUser();
@@ -551,7 +551,7 @@
     }
 
     @Override
-    @SuppressWarnings( "unchecked" )
+    @SuppressWarnings("unchecked")
     public <T extends IdentifiableObject> List<T> getAccessibleByLastUpdated( Class<T> clazz, Date lastUpdated )
     {
         User user = currentUserService.getCurrentUser();