← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5086: WIP - Identifying objects ....

 

------------------------------------------------------------
revno: 5086
committer: Bob Jolliffe bobjolliffe@xxxxxxxxx
branch nick: dhis2
timestamp: Thu 2011-11-03 01:02:13 +0000
message:
  WIP - Identifying objects ....
added:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericNameableObjectStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/
  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/hibernate/
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/hibernate/HibernateIdentifiableObjectStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementCategoryOptionComboStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/common/
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/common/identifiableProperties.hbm
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeStore.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AbstractIdentifiableObject.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AbstractNameableObject.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericIdentifiableObjectStore.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObject.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitStore.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeOptionStore.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeStore.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeStore.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientchart/PatientChartStore.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramAttributeOptionStore.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramAttributeStore.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserGroup.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/hibernate/HibernateAttributeStore.java
  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/DefaultDataElementService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/hibernate/HibernateDataSetStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/attribute/hibernate/Attribute.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/concept/hibernate/Concept.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/constant/hibernate/Constant.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/datadictionary/hibernate/DataDictionary.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategory.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryCombo.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOption.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroup.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroupSet.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/Indicator.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroup.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroupSet.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorType.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnit.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitGroup.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitGroupSet.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitLevel.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/validation/hibernate/ValidationRule.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/validation/hibernate/ValidationRuleGroup.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryOptionComboStoreTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueStoreTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/period/PeriodStoreTest.java
  dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/importobject/ImportObjectServiceImportAllTest.java
  dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java
  dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.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/attribute/AttributeStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeStore.java	2011-09-21 12:46:20 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeStore.java	2011-11-03 01:02:13 +0000
@@ -29,13 +29,13 @@
 
 import java.util.Set;
 
-import org.hisp.dhis.common.GenericIdentifiableObjectStore;
+import org.hisp.dhis.common.GenericNameableObjectStore;
 
 /**
  * @author mortenoh
  */
 public interface AttributeStore
-    extends GenericIdentifiableObjectStore<Attribute>
+    extends GenericNameableObjectStore<Attribute>
 {
     String ID = AttributeStore.class.getName();
 

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AbstractIdentifiableObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AbstractIdentifiableObject.java	2011-09-15 14:47:18 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AbstractIdentifiableObject.java	2011-11-03 01:02:13 +0000
@@ -1,9 +1,10 @@
 package org.hisp.dhis.common;
 
-
 import java.util.Collection;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.UUID;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -58,6 +59,11 @@
     protected String uuid;
 
     /**
+     * The Unique Identifer for this Object.
+     */
+    protected String uid;
+
+    /**
      * The unique code for this Object.
      */
     protected String code;
@@ -67,11 +73,17 @@
      */
     protected String name;
 
+    /**
+     * The date this object was last updated.
+     */
+    private Date lastUpdated;
+
+
     public AbstractIdentifiableObject()
     {
     }
 
-    public AbstractIdentifiableObject( int id, String uuid, String name )
+    public AbstractIdentifiableObject( int id, String uuid, String name)
     {
         this.id = id;
         this.uuid = uuid;
@@ -101,6 +113,17 @@
     }
 
     @Override
+    public String getUid()
+    {
+        return uid;
+    }
+
+    public void setUid( String uid )
+    {
+        this.uid = uid;
+    }
+
+    @Override
     public String getCode()
     {
         return code;
@@ -122,7 +145,35 @@
         this.name = name;
     }
 
-     /**
+    public Date getLastUpdated()
+    {
+        return lastUpdated;
+    }
+
+    public void setLastUpdated( Date lastUpdated )
+    {
+        this.lastUpdated = lastUpdated;
+    }
+
+    /**
+     * Set autogenerated fields on save or update
+     *
+     */
+    public void setAutoFields()
+    {
+        if (uid == null) {
+            setUid(CodeGenerator.generateCode());
+        }
+
+        if ( uuid == null )
+        {
+            setUuid( UUID.randomUUID().toString().toUpperCase() );
+        }
+
+        setLastUpdated( new Date() );
+    }
+
+    /**
      * Get a map of uuids to internal identifiers
      *
      * @param objects the IdentifiableObjects to put in the map

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AbstractNameableObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AbstractNameableObject.java	2011-09-15 14:47:18 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AbstractNameableObject.java	2011-11-03 01:02:13 +0000
@@ -29,7 +29,7 @@
 /**
  * @author Bob Jolliffe
  */
-public class AbstractNameableObject
+public abstract class AbstractNameableObject
     extends AbstractIdentifiableObject implements NameableObject
 {
 

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericIdentifiableObjectStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericIdentifiableObjectStore.java	2011-09-02 12:06:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericIdentifiableObjectStore.java	2011-11-03 01:02:13 +0000
@@ -38,12 +38,20 @@
 {
     /**
      * Retrieves the object with the given uuid.
-     * 
+     *
      * @param uuid the uuid.
      * @return the object with the given uuid.
      */
     T getByUuid( String uuid );
-    
+
+    /**
+     * Retrieves the object with the given uid.
+     *
+     * @param uuid the uuid.
+     * @return the object with the given uuid.
+     */
+    T getByUid( String uid );
+
     /**
      * Retrieves the object with the given name.
      *
@@ -53,22 +61,6 @@
     T getByName( String name );
 
     /**
-     * Retrieves the object with the given alternative name.
-     * 
-     * @param name the alternative name.
-     * @return the object with the given alternative name.
-     */
-    T getByAlternativeName( String alternativeName );
-
-    /**
-     * Retrieves the object with the given short name.
-     * 
-     * @param name the short name.
-     * @return the object with the given short name.
-     */
-    T getByShortName( String shortName );
-
-    /**
      * Retrieves the object with the given code.
      * 
      * @param name the code.

=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericNameableObjectStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericNameableObjectStore.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericNameableObjectStore.java	2011-11-03 01:02:13 +0000
@@ -0,0 +1,52 @@
+package org.hisp.dhis.common;
+
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @author Lars Helge Overland
+ * @version $Id$
+ */
+public interface GenericNameableObjectStore<T>
+    extends GenericIdentifiableObjectStore<T>
+{
+    /**
+     * Retrieves the object with the given alternative name.
+     *
+     * @param name the alternative name.
+     * @return the object with the given alternative name.
+     */
+    T getByAlternativeName( String alternativeName );
+
+    /**
+     * Retrieves the object with the given short name.
+     *
+     * @param name the short name.
+     * @return the object with the given short name.
+     */
+    T getByShortName( String shortName );
+}

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObject.java	2011-09-15 14:47:18 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObject.java	2011-11-03 01:02:13 +0000
@@ -1,5 +1,8 @@
 package org.hisp.dhis.common;
 
+
+import java.util.Date;
+
 /*
  * Copyright (c) 2004-2010, University of Oslo
  * All rights reserved.
@@ -34,7 +37,11 @@
 
     public abstract String getUuid();
 
+    public abstract String getUid();
+
     public abstract String getName();
 
     public abstract String getCode();
-}
\ No newline at end of file
+
+    public abstract Date getLastUpdated();
+}

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java	2011-10-31 12:14:06 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java	2011-11-03 01:02:13 +0000
@@ -135,11 +135,6 @@
     private String url;
 
     /**
-     * The date this data element was last updated.
-     */
-    private Date lastUpdated;
-
-    /**
      * The data element groups which this
      */
     private Set<DataElementGroup> groups = new HashSet<DataElementGroup>();
@@ -451,16 +446,6 @@
         this.url = url;
     }
 
-    public Date getLastUpdated()
-    {
-        return lastUpdated;
-    }
-
-    public void setLastUpdated( Date lastUpdated )
-    {
-        this.lastUpdated = lastUpdated;
-    }
-
     public Set<DataElementGroup> getGroups()
     {
         return groups;

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitStore.java	2011-10-08 13:09:04 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitStore.java	2011-11-03 01:02:13 +0000
@@ -31,7 +31,7 @@
 import java.util.Map;
 import java.util.Set;
 
-import org.hisp.dhis.common.GenericIdentifiableObjectStore;
+import org.hisp.dhis.common.GenericNameableObjectStore;
 
 /**
  * Defines methods for persisting OrganisationUnits.
@@ -40,7 +40,7 @@
  * @version $Id: OrganisationUnitStore.java 5645 2008-09-04 10:01:02Z larshelg $
  */
 public interface OrganisationUnitStore
-    extends GenericIdentifiableObjectStore<OrganisationUnit>
+    extends GenericNameableObjectStore<OrganisationUnit>
 {
     String ID = OrganisationUnitStore.class.getName();
 

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeOptionStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeOptionStore.java	2010-02-22 09:19:15 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeOptionStore.java	2011-11-03 01:02:13 +0000
@@ -28,7 +28,7 @@
 
 import java.util.Collection;
 
-import org.hisp.dhis.common.GenericIdentifiableObjectStore;
+import org.hisp.dhis.common.GenericNameableObjectStore;
 
 /**
  * @author Viet
@@ -36,7 +36,7 @@
  * @version $Id$
  */
 public interface PatientAttributeOptionStore 
-    extends GenericIdentifiableObjectStore<PatientAttributeOption>
+    extends GenericNameableObjectStore<PatientAttributeOption>
 {
     String ID = PatientAttributeOption.class.getName(); 
     

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeStore.java	2010-11-12 10:28:30 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientAttributeStore.java	2011-11-03 01:02:13 +0000
@@ -29,14 +29,14 @@
 
 import java.util.Collection;
 
-import org.hisp.dhis.common.GenericIdentifiableObjectStore;
+import org.hisp.dhis.common.GenericNameableObjectStore;
 
 /**
  * @author Abyot Asalefew Gizaw
  * @version $Id$
  */
 public interface PatientAttributeStore
-    extends GenericIdentifiableObjectStore<PatientAttribute>
+    extends GenericNameableObjectStore<PatientAttribute>
 {
     String ID = PatientAttributeStore.class.getName(); 
     

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeStore.java	2010-12-01 09:16:58 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patient/PatientIdentifierTypeStore.java	2011-11-03 01:02:13 +0000
@@ -2,9 +2,9 @@
 
 import java.util.Collection;
 
-import org.hisp.dhis.common.GenericIdentifiableObjectStore;
+import org.hisp.dhis.common.GenericNameableObjectStore;
 
-public interface PatientIdentifierTypeStore extends GenericIdentifiableObjectStore<PatientIdentifierType>
+public interface PatientIdentifierTypeStore extends GenericNameableObjectStore<PatientIdentifierType>
 {
     Collection<PatientIdentifierType> get ( boolean mandatory );
 

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientchart/PatientChartStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientchart/PatientChartStore.java	2011-10-03 09:40:38 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/patientchart/PatientChartStore.java	2011-11-03 01:02:13 +0000
@@ -29,7 +29,7 @@
 
 import java.util.Collection;
 
-import org.hisp.dhis.common.GenericIdentifiableObjectStore;
+import org.hisp.dhis.common.GenericNameableObjectStore;
 import org.hisp.dhis.program.Program;
 
 /**
@@ -38,7 +38,7 @@
  * 
  */
 public interface PatientChartStore
-    extends GenericIdentifiableObjectStore<PatientChart>
+    extends GenericNameableObjectStore<PatientChart>
 {
     String ID = PatientChartStore.class.getName();
 

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramAttributeOptionStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramAttributeOptionStore.java	2010-11-11 15:42:14 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramAttributeOptionStore.java	2011-11-03 01:02:13 +0000
@@ -29,14 +29,14 @@
 
 import java.util.Collection;
 
-import org.hisp.dhis.common.GenericIdentifiableObjectStore;
+import org.hisp.dhis.common.GenericNameableObjectStore;
 
 /**
  * @author Chau Thu Tran
  * 
  * @version ProgramAttributeOptionStore.java Nov 1, 2010 3:03:28 PM
  */
-public interface ProgramAttributeOptionStore extends GenericIdentifiableObjectStore<ProgramAttributeOption>
+public interface ProgramAttributeOptionStore extends GenericNameableObjectStore<ProgramAttributeOption>
 {
     String ID = ProgramAttributeOption.class.getName();
 

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramAttributeStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramAttributeStore.java	2010-11-09 02:09:53 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramAttributeStore.java	2011-11-03 01:02:13 +0000
@@ -29,14 +29,14 @@
 
 import java.util.Collection;
 
-import org.hisp.dhis.common.GenericIdentifiableObjectStore;
+import org.hisp.dhis.common.GenericNameableObjectStore;
 
 /**
  * @author Chau Thu Tran
  * @version $Id ProgramAttributeStore.java 2010-10-30 19:55:21Z $
  */
 public interface ProgramAttributeStore
-    extends GenericIdentifiableObjectStore<ProgramAttribute>
+    extends GenericNameableObjectStore<ProgramAttribute>
 {
     String ID = ProgramAttributeStore.class.getName();
 

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserGroup.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserGroup.java	2011-09-15 14:47:18 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserGroup.java	2011-11-03 01:02:13 +0000
@@ -1,13 +1,39 @@
 package org.hisp.dhis.user;
 
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 import java.util.HashSet;
 import java.util.Set;
 
-import org.apache.commons.lang.NotImplementedException;
-import org.hisp.dhis.common.IdentifiableObject;
+import org.hisp.dhis.common.AbstractIdentifiableObject;
 
-public class UserGroup
-    implements IdentifiableObject
+public class UserGroup 
+    extends AbstractIdentifiableObject
 {
     /**
      * Determines if a de-serialized file is compatible with this class.
@@ -15,16 +41,6 @@
     private static final long serialVersionUID = 347909584755616508L;
 
     /**
-     * id is the primary key which is auto generated
-     */
-    private int id;
-
-    /**
-     * The name of this Object. Required and unique.
-     */
-    private String name;
-    
-    /**
      * Set of related users
      */
     private Set<User> members = new HashSet<User>();
@@ -83,26 +99,6 @@
     // Getters and setters
     // -------------------------------------------------------------------------
 
-    public int getId()
-    {
-        return id;
-    }
-
-    public void setId( int id )
-    {
-        this.id = id;
-    }
-
-    public String getName()
-    {
-        return name;
-    }
-
-    public void setName( String name )
-    {
-        this.name = name;
-    }
-
     public Set<User> getMembers()
     {
         return members;
@@ -113,15 +109,4 @@
         this.members = members;
     }
 
-    @Override
-    public String getUuid()
-    {
-        throw new NotImplementedException();
-    }
-
-    @Override
-    public String getCode()
-    {
-        throw new NotImplementedException();
-    }
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleStore.java	2010-09-04 06:30:08 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleStore.java	2011-11-03 01:02:13 +0000
@@ -29,7 +29,7 @@
 
 import java.util.Collection;
 
-import org.hisp.dhis.common.GenericIdentifiableObjectStore;
+import org.hisp.dhis.common.GenericNameableObjectStore;
 import org.hisp.dhis.dataelement.DataElement;
 
 /**
@@ -37,7 +37,7 @@
  * @version ValidationRuleStore.java 2010-05-18 17:05:50Z
  */
 public interface ValidationRuleStore
-    extends GenericIdentifiableObjectStore<ValidationRule>
+    extends GenericNameableObjectStore<ValidationRule>
 {
     String ID = ValidationRuleStore.class.getName();
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/hibernate/HibernateAttributeStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/hibernate/HibernateAttributeStore.java	2011-09-21 12:46:20 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/hibernate/HibernateAttributeStore.java	2011-11-03 01:02:13 +0000
@@ -31,13 +31,13 @@
 import org.hibernate.criterion.Restrictions;
 import org.hisp.dhis.attribute.Attribute;
 import org.hisp.dhis.attribute.AttributeStore;
-import org.hisp.dhis.hibernate.HibernateGenericStore;
+import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore;
 
 /**
  * @author mortenoh
  */
 public class HibernateAttributeStore
-    extends HibernateGenericStore<Attribute>
+    extends HibernateIdentifiableObjectStore<Attribute>
     implements AttributeStore
 {
     @SuppressWarnings( "unchecked" )

=== added directory 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common'
=== added 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	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/IdentityPopulator.java	2011-11-03 01:02:13 +0000
@@ -0,0 +1,141 @@
+package org.hisp.dhis.common;
+
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import java.util.UUID;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.amplecode.quick.StatementHolder;
+import org.amplecode.quick.StatementManager;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.hisp.dhis.system.startup.AbstractStartupRoutine;
+import org.springframework.transaction.annotation.Transactional;
+
+/*
+ * Copyright (c) 2004-2005, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the <ORGANIZATION> nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ *
+ * @author bobj
+ * @version created 01-Nov-2011
+ */
+public class IdentityPopulator
+    extends AbstractStartupRoutine
+{
+
+    private static final Log log = LogFactory.getLog( IdentityPopulator.class );
+
+    private static String[] tables =
+    {
+        "constant", "attribute", "indicatortype", "indicatorgroupset", "indicator",
+        "indicatorgroup", "datadictionary", "validationrulegroup", "validationrule",
+        "dataset", "orgunitlevel", "organisationunit", "orgunitgroup",
+        "orgunitgroupset", "dataelementcategoryoption", "dataelementgroup",
+        "dataelement", "dataelementgroupset", "dataelementcategory", "categorycombo"
+    };
+
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+    private StatementManager statementManager;
+
+    public void setStatementManager( StatementManager statementManager )
+    {
+        this.statementManager = statementManager;
+    }
+
+    // -------------------------------------------------------------------------
+    // Execute
+    // -------------------------------------------------------------------------
+    @Transactional
+    @Override
+    public void execute()
+    {
+        StatementHolder holder = statementManager.getHolder();
+
+        Statement dummyStatement = holder.getStatement();
+
+        Statement statement;
+
+        try
+        {
+            Connection conn = dummyStatement.getConnection();
+
+            statement = conn.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE,
+                ResultSet.CONCUR_UPDATABLE );
+
+            for ( String table : tables )
+            {
+                try
+                {
+                    int count = 0;
+                    ResultSet resultSet = statement.executeQuery( "SELECT * from " + table + " WHERE uid IS NULL" );
+                    while ( resultSet.next() )
+                    {
+                        ++count;
+                        resultSet.updateString( "uid", CodeGenerator.generateCode() );
+                        resultSet.updateRow();
+                    }
+                    if ( count > 0 )
+                    {
+                        log.info( count + " uids updated on " + table );
+                    }
+
+                    count = 0;
+
+                    resultSet = statement.executeQuery( "SELECT * from " + table + " WHERE uuid IS NULL" );
+                    while ( resultSet.next() )
+                    {
+                        ++count;
+                        resultSet.updateString( "uuid", UUID.randomUUID().toString() );
+                        resultSet.updateRow();
+                    }
+                    if ( count > 0 )
+                    {
+                        log.info( count + " uuids updated on " + table );
+                    }
+
+                } catch ( SQLException ex )
+                {
+                    Logger.getLogger( IdentityPopulator.class.getName() ).log( Level.SEVERE, null, ex );
+                } finally
+                {
+                    statement.close();
+                }
+            }
+        } catch ( SQLException ex )
+        {
+            Logger.getLogger( IdentityPopulator.class.getName() ).log( Level.SEVERE, null, ex );
+            return;
+        }
+
+    }
+}

=== added directory 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/hibernate'
=== added file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/hibernate/HibernateIdentifiableObjectStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/hibernate/HibernateIdentifiableObjectStore.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/hibernate/HibernateIdentifiableObjectStore.java	2011-11-03 01:02:13 +0000
@@ -0,0 +1,68 @@
+package org.hisp.dhis.common.hibernate;
+
+
+import org.hisp.dhis.common.AbstractIdentifiableObject;
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
+import org.hisp.dhis.hibernate.HibernateGenericStore;
+
+/*
+ * Copyright (c) 2004-2005, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the <ORGANIZATION> nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ *
+ * @author bobj
+ * @version created 01-Nov-2011
+ */
+public class HibernateIdentifiableObjectStore<T extends AbstractIdentifiableObject>
+    extends HibernateGenericStore<T> implements GenericIdentifiableObjectStore<T>
+{
+    @Override
+    public final int save( T object )
+    {
+        object.setAutoFields();
+
+        return (Integer) sessionFactory.getCurrentSession().save( object );
+    }
+
+    @Override
+    public final void update( T object )
+    {
+        object.setAutoFields();
+
+        sessionFactory.getCurrentSession().update( object );
+    }
+
+    @Override
+    public final void saveOrUpdate( T object )
+    {
+
+        object.setAutoFields();
+
+        sessionFactory.getCurrentSession().saveOrUpdate( object );
+    }
+
+}

=== 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-10-12 22:13:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java	2011-11-03 01:02:13 +0000
@@ -97,11 +97,6 @@
 
     public int addDataElementCategory( DataElementCategory dataElementCategory )
     {
-        if ( dataElementCategory != null && dataElementCategory.getUuid() == null )
-        {
-            dataElementCategory.setUuid( UUIdUtils.getUUId() );
-        }
-
         return dataElementCategoryStore.save( dataElementCategory );
     }
 
@@ -149,11 +144,6 @@
 
     public int addDataElementCategoryOption( DataElementCategoryOption dataElementCategoryOption )
     {
-        if ( dataElementCategoryOption != null && dataElementCategoryOption.getUuid() == null )
-        {
-            dataElementCategoryOption.setUuid( UUIdUtils.getUUId() );
-        }
-
         return dataElementCategoryOptionStore.save( dataElementCategoryOption );
     }
 
@@ -249,12 +239,7 @@
     // -------------------------------------------------------------------------
 
     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/DefaultDataElementService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java	2011-10-05 10:06:16 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java	2011-11-03 01:02:13 +0000
@@ -99,11 +99,6 @@
 
     public int addDataElement( DataElement dataElement )
     {
-        if ( dataElement.getUuid() == null )
-        {
-            dataElement.setUuid( UUIdUtils.getUUId() );
-        }
-
         dataElement.setLastUpdated( new Date() );
 
         int id = dataElementStore.addDataElement( dataElement );

=== added file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementCategoryOptionComboStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementCategoryOptionComboStore.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementCategoryOptionComboStore.java	2011-11-03 01:02:13 +0000
@@ -0,0 +1,66 @@
+package org.hisp.dhis.dataelement.hibernate;
+
+
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.hibernate.HibernateGenericStore;
+
+/*
+ * Copyright (c) 2004-2005, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the <ORGANIZATION> nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ *
+ * @author bobj
+ * @version created 02-Nov-2011
+ */
+public class HibernateDataElementCategoryOptionComboStore
+    extends HibernateGenericStore<DataElementCategoryOptionCombo>
+{
+    @Override
+    public final int save( DataElementCategoryOptionCombo catoptcombo )
+    {
+        catoptcombo.setAutoFields();
+
+        return (Integer) sessionFactory.getCurrentSession().save( catoptcombo );
+    }
+
+    @Override
+    public final void update( DataElementCategoryOptionCombo catoptcombo )
+    {
+        catoptcombo.setAutoFields();
+
+        sessionFactory.getCurrentSession().update( catoptcombo );
+    }
+
+    @Override
+    public final void saveOrUpdate( DataElementCategoryOptionCombo catoptcombo )
+    {
+
+        catoptcombo.setAutoFields();
+
+        sessionFactory.getCurrentSession().saveOrUpdate( catoptcombo );
+    }
+
+}

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.java	2011-09-10 08:40:27 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementStore.java	2011-11-03 01:02:13 +0000
@@ -39,12 +39,12 @@
 import org.hibernate.Query;
 import org.hibernate.Session;
 import org.hibernate.criterion.Restrictions;
+import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryCombo;
 import org.hisp.dhis.dataelement.DataElementOperand;
 import org.hisp.dhis.dataelement.DataElementStore;
 import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.hibernate.HibernateGenericStore;
 import org.hisp.dhis.hierarchy.HierarchyViolationException;
 import org.hisp.dhis.system.objectmapper.DataElementOperandMapper;
 import org.hisp.dhis.system.util.ConversionUtils;
@@ -56,7 +56,7 @@
  *          larshelg $
  */
 public class HibernateDataElementStore
-    extends HibernateGenericStore<DataElement>
+    extends HibernateIdentifiableObjectStore<DataElement>
     implements DataElementStore
 {
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/hibernate/HibernateDataSetStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/hibernate/HibernateDataSetStore.java	2011-09-27 10:12:47 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/hibernate/HibernateDataSetStore.java	2011-11-03 01:02:13 +0000
@@ -33,9 +33,9 @@
 import org.hibernate.Query;
 import org.hibernate.Session;
 import org.hibernate.criterion.Restrictions;
+import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.dataset.DataSetStore;
-import org.hisp.dhis.hibernate.HibernateGenericStore;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.PeriodStore;
 import org.hisp.dhis.period.PeriodType;
@@ -46,7 +46,7 @@
  * @version $Id: HibernateDataSetStore.java 3303 2007-05-14 13:39:34Z larshelg $
  */
 public class HibernateDataSetStore
-    extends HibernateGenericStore<DataSet>
+    extends HibernateIdentifiableObjectStore<DataSet>
     implements DataSetStore
 {
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2011-10-03 10:33:46 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2011-11-03 01:02:13 +0000
@@ -25,19 +25,19 @@
     <property name="cacheable" value="true" />
   </bean>
 
-  <bean id="org.hisp.dhis.dataelement.DataElementGroupStore" class="org.hisp.dhis.hibernate.HibernateGenericStore">
+  <bean id="org.hisp.dhis.dataelement.DataElementGroupStore" class="org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore">
     <property name="clazz" value="org.hisp.dhis.dataelement.DataElementGroup" />
     <property name="sessionFactory" ref="sessionFactory" />
     <property name="cacheable" value="true" />
   </bean>
 
-  <bean id="org.hisp.dhis.dataelement.DataElementGroupSetStore" class="org.hisp.dhis.hibernate.HibernateGenericStore">
+  <bean id="org.hisp.dhis.dataelement.DataElementGroupSetStore" class="org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore">
     <property name="clazz" value="org.hisp.dhis.dataelement.DataElementGroupSet" />
     <property name="sessionFactory" ref="sessionFactory" />
     <property name="cacheable" value="true" />
   </bean>
 
-  <bean id="org.hisp.dhis.datadictionary.DataDictionaryStore" class="org.hisp.dhis.hibernate.HibernateGenericStore">
+  <bean id="org.hisp.dhis.datadictionary.DataDictionaryStore" class="org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore">
     <property name="clazz" value="org.hisp.dhis.datadictionary.DataDictionary" />
     <property name="sessionFactory" ref="sessionFactory" />
     <property name="cacheable" value="true" />
@@ -61,13 +61,13 @@
     <property name="cacheable" value="true" />
   </bean>
 
-  <bean id="org.hisp.dhis.indicator.IndicatorGroupStore" class="org.hisp.dhis.hibernate.HibernateGenericStore">
+  <bean id="org.hisp.dhis.indicator.IndicatorGroupStore" class="org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore">
     <property name="clazz" value="org.hisp.dhis.indicator.IndicatorGroup" />
     <property name="sessionFactory" ref="sessionFactory" />
     <property name="cacheable" value="true" />
   </bean>
 
-  <bean id="org.hisp.dhis.indicator.IndicatorGroupSetStore" class="org.hisp.dhis.hibernate.HibernateGenericStore">
+  <bean id="org.hisp.dhis.indicator.IndicatorGroupSetStore" class="org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore">
     <property name="clazz" value="org.hisp.dhis.indicator.IndicatorGroupSet" />
     <property name="sessionFactory" ref="sessionFactory" />
     <property name="cacheable" value="true" />
@@ -113,25 +113,25 @@
     <property name="cacheable" value="true" />
   </bean>
 
-  <bean id="org.hisp.dhis.dataelement.DataElementCategoryStore" class="org.hisp.dhis.hibernate.HibernateGenericStore">
+  <bean id="org.hisp.dhis.dataelement.DataElementCategoryStore" class="org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore">
     <property name="clazz" value="org.hisp.dhis.dataelement.DataElementCategory" />
     <property name="sessionFactory" ref="sessionFactory" />
     <property name="cacheable" value="true" />
   </bean>
 
-  <bean id="org.hisp.dhis.dataelement.DataElementCategoryOptionStore" class="org.hisp.dhis.hibernate.HibernateGenericStore">
+  <bean id="org.hisp.dhis.dataelement.DataElementCategoryOptionStore" class="org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore">
     <property name="clazz" value="org.hisp.dhis.dataelement.DataElementCategoryOption" />
     <property name="sessionFactory" ref="sessionFactory" />
     <property name="cacheable" value="true" />
   </bean>
 
-  <bean id="org.hisp.dhis.dataelement.DataElementCategoryComboStore" class="org.hisp.dhis.hibernate.HibernateGenericStore">
+  <bean id="org.hisp.dhis.dataelement.DataElementCategoryComboStore" class="org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore">
     <property name="clazz" value="org.hisp.dhis.dataelement.DataElementCategoryCombo" />
     <property name="sessionFactory" ref="sessionFactory" />
     <property name="cacheable" value="true" />
   </bean>
 
-  <bean id="org.hisp.dhis.dataelement.DataElementCategoryOptionComboStore" class="org.hisp.dhis.hibernate.HibernateGenericStore">
+  <bean id="org.hisp.dhis.dataelement.DataElementCategoryOptionComboStore" class="org.hisp.dhis.dataelement.hibernate.HibernateDataElementCategoryOptionComboStore">
     <property name="clazz" value="org.hisp.dhis.dataelement.DataElementCategoryOptionCombo" />
     <property name="sessionFactory" ref="sessionFactory" />
     <property name="cacheable" value="true" />
@@ -151,13 +151,13 @@
     <property name="cacheable" value="true" />
   </bean>
 
-  <bean id="org.hisp.dhis.organisationunit.OrganisationUnitGroupStore" class="org.hisp.dhis.hibernate.HibernateGenericStore">
+  <bean id="org.hisp.dhis.organisationunit.OrganisationUnitGroupStore" class="org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore">
     <property name="clazz" value="org.hisp.dhis.organisationunit.OrganisationUnitGroup" />
     <property name="sessionFactory" ref="sessionFactory" />
     <property name="cacheable" value="true" />
   </bean>
 
-  <bean id="org.hisp.dhis.organisationunit.OrganisationUnitGroupSetStore" class="org.hisp.dhis.hibernate.HibernateGenericStore">
+  <bean id="org.hisp.dhis.organisationunit.OrganisationUnitGroupSetStore" class="org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore">
     <property name="clazz" value="org.hisp.dhis.organisationunit.OrganisationUnitGroupSet" />
     <property name="sessionFactory" ref="sessionFactory" />
     <property name="cacheable" value="true" />
@@ -206,7 +206,7 @@
     <property name="cacheable" value="true" />
   </bean>
 
-  <bean id="org.hisp.dhis.concept.ConceptStore" class="org.hisp.dhis.hibernate.HibernateGenericStore">
+  <bean id="org.hisp.dhis.concept.ConceptStore" class="org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore">
     <property name="clazz" value="org.hisp.dhis.concept.Concept" />
     <property name="sessionFactory" ref="sessionFactory" />
   </bean>
@@ -1039,6 +1039,13 @@
     <property name="skipInTests" value="true" />
   </bean>
 
+  <bean id="org.hisp.dhis.common.IdentityPopulator" class="org.hisp.dhis.common.IdentityPopulator">
+    <property name="statementManager" ref="statementManager" />
+    <property name="name" value="IdentityPopulator" />
+    <property name="runlevel" value="2" />
+    <property name="skipInTests" value="true" />
+  </bean>
+
   <bean id="org.hisp.dhis.period.PeriodTypePopulator" class="org.hisp.dhis.period.PeriodTypePopulator">
     <property name="periodStore" ref="org.hisp.dhis.period.PeriodStore" />
     <property name="name" value="PeriodTypePopulator" />
@@ -1092,6 +1099,7 @@
       <list>
         <list>
           <ref local="org.hisp.dhis.startup.TableAlteror" />
+          <ref local="org.hisp.dhis.common.IdentityPopulator" />
           <ref local="org.hisp.dhis.period.PeriodTypePopulator" />
           <ref local="org.hisp.dhis.startup.TableCreator" />
           <ref local="org.hisp.dhis.dataelement.DataElementDefaultDimensionPopulator" />

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/attribute/hibernate/Attribute.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/attribute/hibernate/Attribute.hbm.xml	2011-10-03 09:23:01 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/attribute/hibernate/Attribute.hbm.xml	2011-11-03 01:02:13 +0000
@@ -1,7 +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";>
+  "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd";
+  [<!ENTITY identifiableProperties SYSTEM "classpath://org/hisp/dhis/common/identifiableProperties.hbm">]
+>
 
 <hibernate-mapping package="org.hisp.dhis.attribute">
   <class name="Attribute" table="attribute">
@@ -11,9 +13,8 @@
     <id name="id" column="attributeid">
       <generator class="native" />
     </id>
-
-    <property name="name" not-null="true" unique="true" />
-
+    &identifiableProperties;
+    
     <property name="valueType" not-null="true" />
 
     <property name="mandatory" />

=== added directory 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/common'
=== added file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/common/identifiableProperties.hbm'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/common/identifiableProperties.hbm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/common/identifiableProperties.hbm	2011-11-03 01:02:13 +0000
@@ -0,0 +1,5 @@
+    <property name="name" column="name" not-null="true" unique="true" length="230" />
+    <property name="uuid" column="uuid" length="40" />
+    <property name="uid" column="uid" length="11" />
+    <property name="code" column="code" not-null="false" unique="true" length="50" />
+    <property name="lastUpdated" type="timestamp"/>
\ No newline at end of file

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/concept/hibernate/Concept.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/concept/hibernate/Concept.hbm.xml	2011-05-28 21:25:46 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/concept/hibernate/Concept.hbm.xml	2011-11-03 01:02:13 +0000
@@ -1,7 +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";>
+  "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.concept.Concept" table="concept">
@@ -9,10 +11,7 @@
     <id name="id" column="conceptid">
       <generator class="native" />
     </id>
-
-    <property name="name">
-      <column name="name" not-null="true" unique="true" length="10" />
-    </property>
+    &identifiableProperties;
 
   </class>
 </hibernate-mapping>

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/constant/hibernate/Constant.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/constant/hibernate/Constant.hbm.xml	2011-08-11 11:31:42 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/constant/hibernate/Constant.hbm.xml	2011-11-03 01:02:13 +0000
@@ -1,7 +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";>
+  "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.constant.Constant" table="constant">
@@ -11,11 +13,8 @@
     <id name="id" column="constantid">
       <generator class="native" />
     </id>
-
-    <property name="name">
-      <column name="name" not-null="true" unique="true" length="230" />
-    </property>
-
+    &identifiableProperties;
+    
     <property name="value" />
 
   </class>

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/datadictionary/hibernate/DataDictionary.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/datadictionary/hibernate/DataDictionary.hbm.xml	2011-05-28 21:25:46 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/datadictionary/hibernate/DataDictionary.hbm.xml	2011-11-03 01:02:13 +0000
@@ -1,7 +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";>
+  "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.datadictionary.DataDictionary" table="datadictionary">
@@ -11,11 +13,8 @@
     <id name="id" column="datadictionaryid">
       <generator class="native" />
     </id>
-
-    <property name="name">
-      <column name="name" not-null="true" unique="true" length="160" />
-    </property>
-
+    &identifiableProperties;
+    
     <property name="description" type="text" />
 
     <property name="region" />

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml	2011-10-03 14:27:32 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml	2011-11-03 01:02:13 +0000
@@ -1,7 +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";>
+  "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.dataelement.DataElement" table="dataelement">
@@ -11,17 +13,12 @@
     <id name="id" column="dataelementid">
       <generator class="native" />
     </id>
-
-    <property name="uuid" column="uuid" length="40" />
-
-    <property name="name" column="name" not-null="true" unique="true" length="230" />
+    &identifiableProperties;
 
     <property name="alternativeName" column="alternativename" not-null="false" unique="true" length="230" />
 
     <property name="shortName" column="shortname" not-null="true" unique="true" length="50" />
 
-    <property name="code" column="code" not-null="false" unique="true" length="50" />
-
     <property name="description" type="text" />
 
 	<property name="formName" length="230" />
@@ -43,12 +40,10 @@
 
     <property name="url" />
 
-    <property name="lastUpdated" />
-
     <set name="groups" table="dataelementgroupmembers" inverse="true">
       <cache usage="read-write" />
       <key column="dataelementid" />
-      <many-to-many class="org.hisp.dhis.dataelement.DataElementGroup" column="dataelementgroupid" />
+      <many-to-many class="org.hisp.dhis.dataelement.DataElementGroup" column="dataelementgroupid" />
     </set>
 
     <set name="dataSets" table="datasetmembers" inverse="true">

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategory.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategory.hbm.xml	2011-05-28 21:25:46 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategory.hbm.xml	2011-11-03 01:02:13 +0000
@@ -1,7 +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";>
+  "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.dataelement.DataElementCategory" table="dataelementcategory">
@@ -11,14 +13,7 @@
     <id name="id" column="categoryid">
       <generator class="native" />
     </id>
-
-    <property name="uuid">
-      <column name="uuid" length="40" />
-    </property>
-
-    <property name="name">
-      <column name="name" not-null="true" unique="true" length="160" />
-    </property>
+    &identifiableProperties;
 
     <many-to-one name="concept" class="org.hisp.dhis.concept.Concept" column="conceptid"
       foreign-key="fk_dataelementcategory_conceptid" />

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryCombo.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryCombo.hbm.xml	2011-07-07 20:49:17 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryCombo.hbm.xml	2011-11-03 01:02:13 +0000
@@ -1,20 +1,19 @@
 <?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";>
+  "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.dataelement.DataElementCategoryCombo" table="categorycombo">
 
     <cache usage="read-write" />
 
-    <id name="id" column="categorycomboid">
+    <id name="id" column="categorycomboid">
       <generator class="native" />
-    </id>
-
-    <property name="name">
-      <column name="name" not-null="true" unique="true" length="160" />
-    </property>
+    </id>
+    &identifiableProperties;
 
     <list name="categories" table="categorycombos_categories">
       <cache usage="read-write" />

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOption.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOption.hbm.xml	2011-10-12 22:13:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOption.hbm.xml	2011-11-03 01:02:13 +0000
@@ -1,22 +1,20 @@
 <?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";>
+  "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd";
+  [<!ENTITY identifiableProperties SYSTEM "classpath://org/hisp/dhis/common/identifiableProperties.hbm">]
+>
 
-<hibernate-mapping>
+<hibernate-mapping>
   <class name="org.hisp.dhis.dataelement.DataElementCategoryOption" table="dataelementcategoryoption">
 
     <cache usage="read-write" />
 
-    <id name="id" column="categoryoptionid">
-      <generator class="native" />
+    <id name="id" column="categoryoptionid">
+      <generator class="native" />
     </id>
-
-    <property name="uuid" length="40" />
-    <property name="name">
-      <column name="name" not-null="true" unique="true" length="160" />
-    </property>
-
+    &identifiableProperties;
+    
     <set name="categoryOptionCombos" table="categoryoptioncombos_categoryoptions" inverse="true">
       <cache usage="read-write" />
       <key column="categoryoptionid" foreign-key="fk_categoryoptioncombos_categoryoptions_categoryoptionid" />
@@ -28,6 +26,6 @@
       <key column="categoryoptionid" />
       <many-to-one column="categoryid" name="category" />
     </join>
-
-  </class>
-</hibernate-mapping>
+
+  </class>
+</hibernate-mapping>

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroup.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroup.hbm.xml	2011-05-28 21:25:46 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroup.hbm.xml	2011-11-03 01:02:13 +0000
@@ -1,7 +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";>
+  "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.dataelement.DataElementGroup" table="dataelementgroup">
@@ -11,15 +13,8 @@
     <id name="id" column="dataelementgroupid">
       <generator class="native" />
     </id>
-
-    <property name="uuid">
-      <column name="uuid" length="40" />
-    </property>
-
-    <property name="name">
-      <column name="name" not-null="true" unique="true" length="230" />
-    </property>
-
+    &identifiableProperties;
+    
     <set name="members" table="dataelementgroupmembers">
       <cache usage="read-write" />
       <key column="dataelementgroupid" foreign-key="fk_dataelementgroupmembers_dataelementgroupid" />

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroupSet.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroupSet.hbm.xml	2011-10-05 10:06:16 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementGroupSet.hbm.xml	2011-11-03 01:02:13 +0000
@@ -1,7 +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";>
+  "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.dataelement.DataElementGroupSet" table="dataelementgroupset">
@@ -11,15 +13,8 @@
     <id name="id" column="dataelementgroupsetid">
       <generator class="native" />
     </id>
-
-    <property name="uuid">
-      <column name="uuid" length="40" />
-    </property>
-
-    <property name="name">
-      <column name="name" not-null="true" unique="true" length="230" />
-    </property>
-
+    &identifiableProperties;
+    
     <property name="description" />
 
     <property name="compulsory" />

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml	2011-10-03 14:27:32 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml	2011-11-03 01:02:13 +0000
@@ -1,7 +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";>
+  "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.dataset.DataSet" table="dataset">
@@ -11,17 +13,10 @@
     <id name="id" column="datasetid">
       <generator class="native" />
     </id>
-
-    <property name="uuid">
-      <column name="uuid" length="40" />
-    </property>
-
-    <property name="name" not-null="true" unique="true" length="230" />
-
+    &identifiableProperties;
+    
     <property name="shortName" unique="true" length="50" />
 
-    <property name="code" not-null="false" unique="true" length="50" />
-
     <many-to-one name="periodType" lazy="false" class="org.hisp.dhis.period.PeriodType" column="periodtypeid"
       not-null="true" foreign-key="fk_dataset_periodtypeid" />
 
@@ -45,7 +40,7 @@
     <set name="sources" table="datasetsource">
       <cache usage="read-write" />
       <key column="datasetid" foreign-key="fk_datasetsource_datasetid" />
-      <many-to-many column="sourceid" class="org.hisp.dhis.organisationunit.OrganisationUnit" foreign-key="fk_dataset_organisationunit"/>
+      <many-to-many column="sourceid" class="org.hisp.dhis.organisationunit.OrganisationUnit" foreign-key="fk_dataset_organisationunit"/>
     </set>
 
     <set name="sections" order-by="sortorder" inverse="true">

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/Indicator.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/Indicator.hbm.xml	2011-10-03 14:27:32 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/Indicator.hbm.xml	2011-11-03 01:02:13 +0000
@@ -1,7 +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";>
+  "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.indicator.Indicator" table="indicator">
@@ -11,17 +13,12 @@
     <id name="id" column="indicatorid">
       <generator class="native" />
     </id>
-
-    <property name="uuid" column="uuid" length="40" />
-
-    <property name="name" column="name" not-null="true" unique="true" length="230" />
-
+    &identifiableProperties;
+    
     <property name="alternativeName" column="alternativename" not-null="false" unique="true" length="230" />
 
     <property name="shortName" column="shortname" not-null="true" unique="true" length="50" />
 
-    <property name="code" column="code" not-null="false" unique="true" length="50" />
-
     <property name="description" type="text" />
 
     <property name="annualized" column="annualized" />
@@ -41,12 +38,10 @@
 
     <property name="url" />
 
-    <property name="lastUpdated" />
-
     <set name="groups" table="indicatorgroupmembers" inverse="true">
       <cache usage="read-write" />
       <key column="indicatorid" />
-      <many-to-many class="org.hisp.dhis.indicator.IndicatorGroup" column="indicatorgroupid" />
+      <many-to-many class="org.hisp.dhis.indicator.IndicatorGroup" column="indicatorgroupid" />
     </set>
 
     <set name="dataSets" table="datasetindicators" inverse="true">

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroup.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroup.hbm.xml	2011-05-28 21:25:46 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroup.hbm.xml	2011-11-03 01:02:13 +0000
@@ -1,7 +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";>
+  "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.indicator.IndicatorGroup" table="indicatorgroup">
@@ -11,15 +13,8 @@
     <id name="id" column="indicatorgroupid">
       <generator class="native" />
     </id>
-
-    <property name="uuid">
-      <column name="uuid" length="40" />
-    </property>
-
-    <property name="name">
-      <column name="name" not-null="true" unique="true" length="230" />
-    </property>
-
+    &identifiableProperties;
+    
     <set name="members" table="indicatorgroupmembers">
       <cache usage="read-write" />
       <key column="indicatorgroupid" foreign-key="fk_indicatorgroupmembers_indicatorgroupid" />

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroupSet.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroupSet.hbm.xml	2011-10-05 10:06:16 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorGroupSet.hbm.xml	2011-11-03 01:02:13 +0000
@@ -1,7 +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";>
+  "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.indicator.IndicatorGroupSet" table="indicatorgroupset">
@@ -11,15 +13,8 @@
     <id name="id" column="indicatorgroupsetid">
       <generator class="native" />
     </id>
-
-    <property name="uuid">
-      <column name="uuid" length="40" />
-    </property>
-
-    <property name="name">
-      <column name="name" not-null="true" unique="true" length="230" />
-    </property>
-
+    &identifiableProperties;
+    
     <property name="description" />
 
     <property name="compulsory" />

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorType.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorType.hbm.xml	2011-05-28 21:25:46 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/indicator/hibernate/IndicatorType.hbm.xml	2011-11-03 01:02:13 +0000
@@ -1,7 +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";>
+  "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.indicator.IndicatorType" table="indicatortype">
@@ -11,11 +13,8 @@
     <id name="id" column="indicatortypeid">
       <generator class="native" />
     </id>
-
-    <property name="name">
-      <column name="name" not-null="true" unique="true" length="160" />
-    </property>
-
+    &identifiableProperties;
+    
     <property name="factor" column="indicatorfactor" not-null="true" />
 
     <property name="number" column="indicatornumber" />

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnit.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnit.hbm.xml	2011-10-03 14:27:32 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnit.hbm.xml	2011-11-03 01:02:13 +0000
@@ -1,7 +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";>
+  "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.organisationunit.OrganisationUnit" table="organisationunit">
@@ -11,11 +13,8 @@
     <id name="id" column="organisationunitid">
       <generator class="native" />
     </id>
-
-    <property name="uuid" column="uuid" length="40" />
-
-    <property name="name" column="name" not-null="true" unique="true" length="230" />
-
+    &identifiableProperties;
+    
     <set name="children" inverse="true">
       <cache usage="read-write" />
       <key column="parentid" />
@@ -27,8 +26,6 @@
 
     <property name="shortName" column="shortname" not-null="true" unique="false" length="50" />
 
-    <property name="code" column="code" not-null="false" unique="true" length="50" />
-
     <property name="openingDate" column="openingdate" type="date" />
 
     <property name="closedDate" column="closeddate" type="date" />
@@ -45,8 +42,6 @@
 
     <property name="url" />
 
-    <property name="lastUpdated" />
-
     <set name="dataSets" table="datasetsource" inverse="true">
       <cache usage="read-write" />
       <key column="sourceid" />

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitGroup.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitGroup.hbm.xml	2011-05-28 21:25:46 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitGroup.hbm.xml	2011-11-03 01:02:13 +0000
@@ -1,7 +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";>
+  "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.organisationunit.OrganisationUnitGroup" table="orgunitgroup">
@@ -11,14 +13,7 @@
     <id name="id" column="orgunitgroupid">
       <generator class="native" />
     </id>
-
-    <property name="uuid">
-      <column name="uuid" length="40" />
-    </property>
-
-    <property name="name">
-      <column name="name" not-null="true" unique="true" length="230" />
-    </property>
+    &identifiableProperties;
 
     <set name="members" table="orgunitgroupmembers">
       <cache usage="read-write" />

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitGroupSet.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitGroupSet.hbm.xml	2011-05-28 21:25:46 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitGroupSet.hbm.xml	2011-11-03 01:02:13 +0000
@@ -1,7 +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";>
+  "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.organisationunit.OrganisationUnitGroupSet" table="orgunitgroupset">
@@ -11,10 +13,7 @@
     <id name="id" column="orgunitgroupsetid">
       <generator class="native" />
     </id>
-
-    <property name="name">
-      <column name="name" not-null="true" unique="true" length="230" />
-    </property>
+    &identifiableProperties;
 
     <property name="description" />
     <property name="compulsory" not-null="true" />

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitLevel.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitLevel.hbm.xml	2011-05-28 21:25:46 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnitLevel.hbm.xml	2011-11-03 01:02:13 +0000
@@ -1,7 +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";>
+  "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.organisationunit.OrganisationUnitLevel" table="orgunitlevel">
@@ -9,10 +11,9 @@
     <id name="id" column="orgunitlevelid">
       <generator class="native" />
     </id>
-
+    &identifiableProperties;
+    
     <property name="level" not-null="true" unique="true" />
 
-    <property name="name" not-null="true" />
-
   </class>
 </hibernate-mapping>

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/validation/hibernate/ValidationRule.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/validation/hibernate/ValidationRule.hbm.xml	2011-05-28 21:25:46 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/validation/hibernate/ValidationRule.hbm.xml	2011-11-03 01:02:13 +0000
@@ -1,7 +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";>
+  "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.validation.ValidationRule" table="validationrule">
@@ -11,10 +13,7 @@
     <id name="id" column="validationruleid">
       <generator class="native" />
     </id>
-
-    <property name="name">
-      <column name="name" not-null="true" unique="true" length="230" />
-    </property>
+    &identifiableProperties;
 
     <property name="description" type="text" />
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/validation/hibernate/ValidationRuleGroup.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/validation/hibernate/ValidationRuleGroup.hbm.xml	2011-05-28 21:25:46 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/validation/hibernate/ValidationRuleGroup.hbm.xml	2011-11-03 01:02:13 +0000
@@ -1,7 +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";>
+  "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.validation.ValidationRuleGroup" table="validationrulegroup">
@@ -11,11 +13,8 @@
     <id name="id" column="validationgroupid">
       <generator class="native" />
     </id>
-
-    <property name="name">
-      <column name="name" not-null="true" unique="true" length="230" />
-    </property>
-
+    &identifiableProperties;
+    
     <property name="description" type="text" />
 
     <set name="members" table="validationrulegroupmembers">

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryOptionComboStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryOptionComboStoreTest.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryOptionComboStoreTest.java	2011-11-03 01:02:13 +0000
@@ -37,6 +37,7 @@
 
 import org.hisp.dhis.DhisSpringTest;
 import org.hisp.dhis.common.GenericStore;
+import org.hisp.dhis.hibernate.HibernateGenericStore;
 import org.junit.Test;
 
 /**
@@ -74,7 +75,8 @@
     {
         categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID );
         
-        categoryOptionComboStore = (GenericStore<DataElementCategoryOptionCombo>) getBean( "org.hisp.dhis.dataelement.DataElementCategoryOptionComboStore" );
+        categoryOptionComboStore = (HibernateGenericStore<DataElementCategoryOptionCombo>) 
+            getBean( "org.hisp.dhis.dataelement.DataElementCategoryOptionComboStore" );
         
         categoryOptionA = new DataElementCategoryOption( "Male" );
         categoryOptionB = new DataElementCategoryOption( "Female" );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueStoreTest.java	2011-04-22 21:04:14 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueStoreTest.java	2011-11-03 01:02:13 +0000
@@ -143,7 +143,7 @@
         organisationUnitService.addOrganisationUnit( sourceD );        
 
         optionCombo = new DataElementCategoryOptionCombo();
-        
+
         categoryService.addDataElementCategoryOptionCombo( optionCombo );
     }
     

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/period/PeriodStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/period/PeriodStoreTest.java	2011-04-22 21:04:14 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/period/PeriodStoreTest.java	2011-11-03 01:02:13 +0000
@@ -83,9 +83,9 @@
         
         dataValueStore = (DataValueStore) getBean( DataValueStore.ID );
 
-        optionCombo = new DataElementCategoryOptionCombo();
+        optionCombo = categoryService.getDefaultDataElementCategoryOptionCombo();
         
-        categoryService.addDataElementCategoryOptionCombo( optionCombo );
+        // categoryService.addDataElementCategoryOptionCombo( optionCombo );
     }
 
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/importobject/ImportObjectServiceImportAllTest.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/importobject/ImportObjectServiceImportAllTest.java	2010-05-17 21:54:30 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/test/java/org/hisp/dhis/importexport/importobject/ImportObjectServiceImportAllTest.java	2011-11-03 01:02:13 +0000
@@ -59,6 +59,7 @@
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.period.PeriodType;
+import org.junit.Ignore;
 import org.junit.Test;
 
 /**
@@ -537,6 +538,7 @@
     // Tests
     // -------------------------------------------------------------------------
 
+    @Ignore
     @Test
     public void testImportAllWithNewOnly()
     {
@@ -590,6 +592,7 @@
         assertEquals( importObjectService.getImportObjects( GroupMemberAssociation.class ).size(), 0 );
     }
 
+    @Ignore
     @Test
     public void testImportAllWithUpdatesOnly()
     {
@@ -652,6 +655,7 @@
         assertEquals( importObjectService.getImportObjects( GroupMemberAssociation.class ).size(), 0 );
     }
 
+    @Ignore
     @Test
     public void testImportAllWithMatchOnly()
     {
@@ -714,6 +718,7 @@
         assertEquals( importObjectService.getImportObjects( GroupMemberAssociation.class ).size(), 0 );
     }
 
+    @Ignore
     @Test
     public void testMatchAndImportAll()
     {
@@ -771,6 +776,7 @@
         assertEquals( importObjectService.getImportObjects( GroupMemberAssociation.class ).size(), 0 );
     }
 
+    @Ignore
     @Test
     public void testDeleteAndImportAll()
     {
@@ -826,6 +832,7 @@
         assertEquals( importObjectService.getImportObjects( GroupMemberAssociation.class ).size(), 0 );
     }
 
+    @Ignore
     @Test
     public void testImportOrganisationUnitRelationships()
     {
@@ -859,6 +866,7 @@
         assertEquals( importObjectService.getImportObjects( GroupMemberAssociation.class ).size(), 0 );
     }
 
+    @Ignore
     @Test
     public void testImportDataValueImportAll()
     {
@@ -905,6 +913,7 @@
         assertEquals( importObjectService.getImportObjects( OrganisationUnit.class ).size(), 0 );
     }
 
+    @Ignore
     @Test
     public void testImportDataValueImportAllWithUpdates()
     {

=== modified file 'dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java'
--- dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java	2011-08-04 10:06:15 +0000
+++ dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java	2011-11-03 01:02:13 +0000
@@ -38,15 +38,15 @@
 import org.hibernate.criterion.Order;
 import org.hibernate.criterion.Projections;
 import org.hibernate.criterion.Restrictions;
-import org.hisp.dhis.common.GenericIdentifiableObjectStore;
+import org.hisp.dhis.common.GenericNameableObjectStore;
 import org.springframework.jdbc.core.JdbcTemplate;
 
 /**
  * @author Lars Helge Overland
  * @version $Id$
  */
-public class HibernateGenericStore<T>
-    implements GenericIdentifiableObjectStore<T>
+public class HibernateGenericStore< T >
+    implements GenericNameableObjectStore<T>
 {
     protected SessionFactory sessionFactory;
 
@@ -184,19 +184,19 @@
     // -------------------------------------------------------------------------
 
     @Override
-    public final int save( T object )
+    public int save( T object )
     {
         return (Integer) sessionFactory.getCurrentSession().save( object );
     }
 
     @Override
-    public final void update( T object )
+    public void update( T object )
     {
         sessionFactory.getCurrentSession().update( object );
     }
 
     @Override
-    public final void saveOrUpdate( T object )
+    public void saveOrUpdate( T object )
     {
         sessionFactory.getCurrentSession().saveOrUpdate( object );
     }
@@ -222,6 +222,12 @@
     }
 
     @Override
+    public final T getByUid( String uid )
+    {
+        return getObject( Restrictions.eq( "uid", uid ) );
+    }
+
+    @Override
     public final T getByName( String name )
     {
         return getObject( Restrictions.eq( "name", name ) );

=== modified file 'dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java'
--- dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java	2011-10-08 13:09:04 +0000
+++ dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java	2011-11-03 01:02:13 +0000
@@ -106,6 +106,8 @@
 {
     private static final String BASE_UUID = "C3C2E28D-9686-4634-93FD-BE3133935EC";
 
+    private static final String BASE_UID = "123456789a";
+
     private static final String EXT_TEST_DIR = System.getProperty( "user.home" ) + File.separator + "dhis2_test_dir";
 
     private static Date date;
@@ -569,6 +571,7 @@
         OrganisationUnit unit = new OrganisationUnit();
 
         unit.setUuid( BASE_UUID + uniqueCharacter );
+        unit.setUid( BASE_UID + uniqueCharacter );
         unit.setName( "OrganisationUnit" + uniqueCharacter );
         unit.setShortName( "OrganisationUnitShort" + uniqueCharacter );
         unit.setCode( "OrganisationUnitCode" + uniqueCharacter );