← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9771: removed uniqueness on name/shortName for dataSet

 

------------------------------------------------------------
revno: 9771
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-02-08 11:20:26 +0700
message:
  removed uniqueness on name/shortName for dataSet
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSetService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
  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/test/java/org/hisp/dhis/dataset/DataSetServiceTest.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/importer/DataSetImporter.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/ValidateDataSetAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/addDataSet.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/editDataSet.js


--
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/dataset/DataSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java	2013-02-04 07:45:14 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java	2013-02-08 04:20:26 +0000
@@ -359,12 +359,6 @@
     // -------------------------------------------------------------------------
 
     @Override
-    public int hashCode()
-    {
-        return name.hashCode();
-    }
-
-    @Override
     public boolean equals( Object o )
     {
         if ( this == o )

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSetService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSetService.java	2012-05-15 15:28:44 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSetService.java	2013-02-08 04:20:26 +0000
@@ -27,15 +27,15 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodType;
 
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+
 /**
  * @author Lars Helge Overland
  * @version $Id: DataSetService.java 6255 2008-11-10 16:01:24Z larshelg $
@@ -103,7 +103,7 @@
      * @param name The name.
      * @return A DataSet with the given name.
      */
-    DataSet getDataSetByName( String name );
+    List<DataSet> getDataSetByName( String name );
 
     /**
      * Returns the DataSet with the given short name.
@@ -111,12 +111,12 @@
      * @param shortName The short name.
      * @return The DataSet with the given short name.
      */
-    DataSet getDataSetByShortName( String shortName );
+    List<DataSet> getDataSetByShortName( String shortName );
 
     /**
      * Returns the DataSet with the given code.
      *
-     * @param shortName The code.
+     * @param code The code.
      * @return The DataSet with the given code.
      */
     DataSet getDataSetByCode( String code );
@@ -203,12 +203,12 @@
 
     /**
      * Returns a list of data sets with the given uids.
-     * 
+     *
      * @param uids the collection of uids.
      * @return a list of data sets.
      */
     List<DataSet> getDataSetsByUid( Collection<String> uids );
-    
+
     /**
      * Returns a collection of data elements associated with the given
      * corresponding data set.
@@ -315,21 +315,21 @@
     /**
      * Checks whether the system is locked for data entry for the given input.
      *
-     * @param dataSet the data set
-     * @param period Period the period.s
+     * @param dataSet          the data set
+     * @param period           Period the period.s
      * @param organisationUnit the organisation unit.
-     * @param now the base date for deciding locked date, current date if null.
+     * @param now              the base date for deciding locked date, current date if null.
      * @return true or false indicating whether the system is locked or not.
      */
     boolean isLocked( DataSet dataSet, Period period, OrganisationUnit organisationUnit, Date now );
-    
+
     /**
      * Checks whether the system is locked for data entry for the given input.
-     * 
-     * @param dataElement the data element.
-     * @param period the period.
+     *
+     * @param dataElement      the data element.
+     * @param period           the period.
      * @param organisationUnit the organisation unit.
-     * @param now the base date for deciding locked date, current date if null.
+     * @param now              the base date for deciding locked date, current date if null.
      * @return true or false indicating whether the system is locked or not.
      */
     boolean isLocked( DataElement dataElement, Period period, OrganisationUnit organisationUnit, Date now );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java	2013-01-14 21:35:56 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java	2013-02-08 04:20:26 +0000
@@ -27,19 +27,6 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.hisp.dhis.i18n.I18nUtils.getCountByName;
-import static org.hisp.dhis.i18n.I18nUtils.getObjectsBetween;
-import static org.hisp.dhis.i18n.I18nUtils.getObjectsBetweenByName;
-import static org.hisp.dhis.i18n.I18nUtils.i18n;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataentryform.DataEntryForm;
 import org.hisp.dhis.i18n.I18nService;
@@ -51,6 +38,16 @@
 import org.joda.time.DateTime;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import static org.hisp.dhis.i18n.I18nUtils.*;
+
 /**
  * @author Lars Helge Overland
  * @version $Id: DefaultDataSetService.java 6255 2008-11-10 16:01:24Z larshelg $
@@ -135,14 +132,14 @@
         return dataSet;
     }
 
-    public DataSet getDataSetByName( String name )
+    public List<DataSet> getDataSetByName( String name )
     {
-        return i18n( i18nService, dataSetStore.getByName( name ) );
+        return new ArrayList<DataSet>( i18n( i18nService, dataSetStore.getAllEqName( name ) ) );
     }
 
-    public DataSet getDataSetByShortName( String shortName )
+    public List<DataSet> getDataSetByShortName( String shortName )
     {
-        return i18n( i18nService, dataSetStore.getByShortName( shortName ) );
+        return new ArrayList<DataSet>( i18n( i18nService, dataSetStore.getAllEqShortName( shortName ) ) );
     }
 
     public DataSet getDataSetByCode( String code )

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2013-02-07 12:38:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2013-02-08 04:20:26 +0000
@@ -516,6 +516,9 @@
         executeSql( "ALTER TABLE indicatorgroup DROP CONSTRAINT indicatorgroup_name_key" );
         executeSql( "ALTER TABLE indicatorgroupset DROP CONSTRAINT indicatorgroupset_name_key" );
 
+        executeSql( "ALTER TABLE dataset DROP CONSTRAINT dataset_name_key" );
+        executeSql( "ALTER TABLE dataset DROP CONSTRAINT dataset_shortname_key" );
+
         log.info( "Tables updated" );
     }
 

=== 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	2013-02-07 10:25:34 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml	2013-02-08 04:20:26 +0000
@@ -15,9 +15,9 @@
     </id>
     &identifiableProperties;
 
-    <property name="name" column="name" not-null="true" unique="true" length="230" />
+    <property name="name" column="name" not-null="true" unique="false" length="230" />
 
-    <property name="shortName" unique="true" length="50" />
+    <property name="shortName" unique="false" length="50" />
 
     <property name="description" type="text" />
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/DataSetServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/DataSetServiceTest.java	2012-11-20 17:04:08 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataset/DataSetServiceTest.java	2013-02-08 04:20:26 +0000
@@ -27,15 +27,6 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Collection;
-import java.util.HashSet;
-
 import org.hisp.dhis.DhisSpringTest;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementService;
@@ -47,6 +38,11 @@
 import org.hisp.dhis.period.PeriodType;
 import org.junit.Test;
 
+import java.util.Collection;
+import java.util.HashSet;
+
+import static org.junit.Assert.*;
+
 /**
  * @author Lars Helge Overland
  * @version $Id$
@@ -61,13 +57,13 @@
         throws Exception
     {
         dataSetService = (DataSetService) getBean( DataSetService.ID );
-        
+
         dataElementService = (DataElementService) getBean( DataElementService.ID );
 
         organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
-        
+
         periodService = (PeriodService) getBean( PeriodService.ID );
-        
+
         periodType = new MonthlyPeriodType();
     }
 
@@ -81,7 +77,7 @@
         assertEquals( "DataSetShort" + uniqueCharacter, dataSet.getShortName() );
         assertEquals( periodType, dataSet.getPeriodType() );
     }
-    
+
     // -------------------------------------------------------------------------
     // DataSet
     // -------------------------------------------------------------------------
@@ -91,16 +87,16 @@
     {
         DataSet dataSetA = createDataSet( 'A', periodType );
         DataSet dataSetB = createDataSet( 'B', periodType );
-        
+
         int idA = dataSetService.addDataSet( dataSetA );
-        int idB = dataSetService.addDataSet( dataSetB );       
-        
+        int idB = dataSetService.addDataSet( dataSetB );
+
         dataSetA = dataSetService.getDataSet( idA );
         dataSetB = dataSetService.getDataSet( idB );
-        
+
         assertEquals( idA, dataSetA.getId() );
         assertEq( 'A', dataSetA );
-        
+
         assertEquals( idB, dataSetB.getId() );
         assertEq( 'B', dataSetB );
     }
@@ -109,19 +105,19 @@
     public void testUpdateDataSet()
     {
         DataSet dataSet = createDataSet( 'A', periodType );
-        
+
         int id = dataSetService.addDataSet( dataSet );
-        
+
         dataSet = dataSetService.getDataSet( id );
-        
+
         assertEq( 'A', dataSet );
-        
+
         dataSet.setName( "DataSetB" );
-        
+
         dataSetService.updateDataSet( dataSet );
-        
+
         dataSet = dataSetService.getDataSet( id );
-        
+
         assertEquals( dataSet.getName(), "DataSetB" );
     }
 
@@ -130,22 +126,22 @@
     {
         DataSet dataSetA = createDataSet( 'A', periodType );
         DataSet dataSetB = createDataSet( 'B', periodType );
-        
+
         int idA = dataSetService.addDataSet( dataSetA );
         int idB = dataSetService.addDataSet( dataSetB );
-        
+
         assertNotNull( dataSetService.getDataSet( idA ) );
         assertNotNull( dataSetService.getDataSet( idB ) );
-        
+
         dataSetService.deleteDataSet( dataSetService.getDataSet( idA ) );
-        
+
         assertNull( dataSetService.getDataSet( idA ) );
         assertNotNull( dataSetService.getDataSet( idB ) );
 
         dataSetService.deleteDataSet( dataSetService.getDataSet( idB ) );
-        
+
         assertNull( dataSetService.getDataSet( idA ) );
-        assertNull( dataSetService.getDataSet( idB ) );        
+        assertNull( dataSetService.getDataSet( idB ) );
     }
 
     @Test
@@ -154,13 +150,13 @@
     {
         DataSet dataSetA = createDataSet( 'A', periodType );
         DataSet dataSetB = createDataSet( 'B', periodType );
-    
+
         int idA = dataSetService.addDataSet( dataSetA );
         int idB = dataSetService.addDataSet( dataSetB );
-    
-        assertEquals( dataSetService.getDataSetByName( "DataSetA" ).getId(), idA );
-        assertEquals( dataSetService.getDataSetByName( "DataSetB" ).getId(), idB );
-        assertNull( dataSetService.getDataSetByName( "DataSetC" ) );
+
+        assertEquals( dataSetService.getDataSetByName( "DataSetA" ).get( 0 ).getId(), idA );
+        assertEquals( dataSetService.getDataSetByName( "DataSetB" ).get( 0 ).getId(), idB );
+        assertTrue( dataSetService.getDataSetByName( "DataSetC" ).isEmpty() );
     }
 
     @Test
@@ -173,9 +169,9 @@
         int idA = dataSetService.addDataSet( dataSetA );
         int idB = dataSetService.addDataSet( dataSetB );
 
-        assertEquals( dataSetService.getDataSetByShortName( "DataSetShortA" ).getId(), idA );
-        assertEquals( dataSetService.getDataSetByShortName( "DataSetShortB" ).getId(), idB );
-        assertNull( dataSetService.getDataSetByShortName( "DataSetShortC" ) );
+        assertEquals( dataSetService.getDataSetByShortName( "DataSetShortA" ).get( 0 ).getId(), idA );
+        assertEquals( dataSetService.getDataSetByShortName( "DataSetShortB" ).get( 0 ).getId(), idB );
+        assertTrue( dataSetService.getDataSetByShortName( "DataSetShortC" ).isEmpty() );
     }
 
     @Test
@@ -183,23 +179,23 @@
     {
         DataSet dataSetA = createDataSet( 'A', periodType );
         DataSet dataSetB = createDataSet( 'B', periodType );
-    
+
         dataSetService.addDataSet( dataSetA );
         dataSetService.addDataSet( dataSetB );
-        
+
         Collection<DataSet> dataSets = dataSetService.getAllDataSets();
-        
+
         assertEquals( dataSets.size(), 2 );
         assertTrue( dataSets.contains( dataSetA ) );
-        assertTrue( dataSets.contains( dataSetB ) );            
+        assertTrue( dataSets.contains( dataSetB ) );
     }
 
     @Test
     public void testGetDataSetsBySources()
     {
         OrganisationUnit unitA = createOrganisationUnit( 'A' );
-        OrganisationUnit unitB = createOrganisationUnit( 'B' );  
-        OrganisationUnit unitC = createOrganisationUnit( 'C' );  
+        OrganisationUnit unitB = createOrganisationUnit( 'B' );
+        OrganisationUnit unitC = createOrganisationUnit( 'C' );
         organisationUnitService.addOrganisationUnit( unitA );
         organisationUnitService.addOrganisationUnit( unitB );
         organisationUnitService.addOrganisationUnit( unitC );
@@ -212,16 +208,16 @@
         dataSetA.getSources().add( unitB );
         dataSetB.getSources().add( unitA );
         dataSetC.getSources().add( unitB );
-        
+
         dataSetService.addDataSet( dataSetA );
         dataSetService.addDataSet( dataSetB );
         dataSetService.addDataSet( dataSetC );
         dataSetService.addDataSet( dataSetD );
-        
+
         Collection<OrganisationUnit> sources = new HashSet<OrganisationUnit>();
         sources.add( unitA );
         sources.add( unitB );
-        
+
         Collection<DataSet> dataSets = dataSetService.getDataSetsBySources( sources );
 
         assertEquals( 3, dataSets.size() );
@@ -231,14 +227,14 @@
 
         sources = new HashSet<OrganisationUnit>();
         sources.add( unitA );
-        
+
         dataSets = dataSetService.getDataSetsBySources( sources );
-        
+
         assertEquals( 2, dataSets.size() );
         assertTrue( dataSets.contains( dataSetA ) );
         assertTrue( dataSets.contains( dataSetB ) );
     }
-    
+
     @Test
     public void testGetSourcesAssociatedWithDataSet()
     {
@@ -248,39 +244,39 @@
         OrganisationUnit sourceD = createOrganisationUnit( 'D' );
         OrganisationUnit sourceE = createOrganisationUnit( 'E' );
         OrganisationUnit sourceF = createOrganisationUnit( 'F' );
-        
+
         organisationUnitService.addOrganisationUnit( sourceA );
         organisationUnitService.addOrganisationUnit( sourceB );
         organisationUnitService.addOrganisationUnit( sourceC );
         organisationUnitService.addOrganisationUnit( sourceD );
         organisationUnitService.addOrganisationUnit( sourceE );
         organisationUnitService.addOrganisationUnit( sourceF );
-        
+
         DataSet dataSetA = createDataSet( 'A', periodType );
         DataSet dataSetB = createDataSet( 'B', periodType );
-        
+
         dataSetA.getSources().add( sourceA );
         dataSetA.getSources().add( sourceB );
         dataSetA.getSources().add( sourceC );
 
         dataSetB.getSources().add( sourceC );
         dataSetB.getSources().add( sourceD );
-        dataSetB.getSources().add( sourceE );       
-        
+        dataSetB.getSources().add( sourceE );
+
         dataSetService.addDataSet( dataSetA );
         dataSetService.addDataSet( dataSetB );
 
         Collection<OrganisationUnit> sources = new HashSet<OrganisationUnit>();
-        
+
         sources.add( sourceA );
         sources.add( sourceB );
         sources.add( sourceD );
         sources.add( sourceE );
-        
+
         assertEquals( 2, dataSetService.getSourcesAssociatedWithDataSet( dataSetA, sources ) );
         assertEquals( 2, dataSetService.getSourcesAssociatedWithDataSet( dataSetB, sources ) );
     }
-    
+
     // -------------------------------------------------------------------------
     // LockException
     // -------------------------------------------------------------------------
@@ -291,22 +287,22 @@
         OrganisationUnit unit = createOrganisationUnit( 'A' );
         Period period = periodType.createPeriod();
         DataSet dataSet = createDataSet( 'A', periodType );
-        
+
         organisationUnitService.addOrganisationUnit( unit );
         dataSetService.addDataSet( dataSet );
-        
-        LockException lockException = new LockException( period, unit, dataSet ); 
-        
+
+        LockException lockException = new LockException( period, unit, dataSet );
+
         int id = dataSetService.addLockException( lockException );
-        
+
         lockException = dataSetService.getLockException( id );
-        
+
         assertNotNull( lockException );
         assertEquals( unit, lockException.getOrganisationUnit() );
         assertEquals( period, lockException.getPeriod() );
         assertEquals( dataSet, lockException.getDataSet() );
     }
-    
+
     @Test
     public void testIsLockedDataElement()
     {
@@ -316,14 +312,14 @@
         DataSet dataSetB = createDataSet( 'B', periodType );
         dataSetA.setExpiryDays( 20 );
         dataSetB.setExpiryDays( 10 );
-        
+
         DataElement dataElementA = createDataElement( 'A' );
         DataElement dataElementB = createDataElement( 'B' );
         dataElementA.getDataSets().add( dataSetA );
         dataElementA.getDataSets().add( dataSetB );
         dataSetA.getDataElements().add( dataElementA );
         dataSetB.getDataElements().add( dataElementA );
-        
+
         organisationUnitService.addOrganisationUnit( unit );
         periodService.addPeriod( period );
         dataElementService.addDataElement( dataElementA );
@@ -340,21 +336,21 @@
         assertTrue( dataSetService.isLocked( dataElementA, period, unit, getDate( 2000, 4, 15 ) ) );
         assertTrue( dataSetService.isLocked( dataElementA, period, unit, getDate( 2000, 4, 25 ) ) );
         assertFalse( dataSetService.isLocked( dataElementB, period, unit, getDate( 2000, 4, 25 ) ) );
-        
+
         // ---------------------------------------------------------------------
         // Lock exception
         // ---------------------------------------------------------------------
 
-        LockException lockException = new LockException( period, unit, dataSetA );        
+        LockException lockException = new LockException( period, unit, dataSetA );
         dataSetService.addLockException( lockException );
 
         assertFalse( dataSetService.isLocked( dataElementA, period, unit, getDate( 2000, 4, 1 ) ) );
         assertFalse( dataSetService.isLocked( dataElementA, period, unit, getDate( 2000, 4, 5 ) ) );
         assertFalse( dataSetService.isLocked( dataElementA, period, unit, getDate( 2000, 4, 15 ) ) );
         assertFalse( dataSetService.isLocked( dataElementA, period, unit, getDate( 2000, 4, 25 ) ) );
-        assertFalse( dataSetService.isLocked( dataElementB, period, unit, getDate( 2000, 4, 25 ) ) );      
+        assertFalse( dataSetService.isLocked( dataElementB, period, unit, getDate( 2000, 4, 25 ) ) );
     }
-    
+
     @Test
     public void testIsLockedDataSet()
     {
@@ -364,7 +360,7 @@
         DataSet dataSetB = createDataSet( 'B', periodType );
         dataSetA.setExpiryDays( 10 );
         dataSetB.setExpiryDays( 15 );
-        
+
         organisationUnitService.addOrganisationUnit( unit );
         periodService.addPeriod( period );
         dataSetService.addDataSet( dataSetA );
@@ -380,12 +376,12 @@
         assertTrue( dataSetService.isLocked( dataSetA, period, unit, getDate( 2000, 4, 25 ) ) );
         assertFalse( dataSetService.isLocked( dataSetB, period, unit, getDate( 2000, 4, 10 ) ) );
         assertTrue( dataSetService.isLocked( dataSetB, period, unit, getDate( 2000, 4, 25 ) ) );
-        
+
         // ---------------------------------------------------------------------
         // Lock exception
         // ---------------------------------------------------------------------
 
-        LockException lockException = new LockException( period, unit, dataSetA );        
+        LockException lockException = new LockException( period, unit, dataSetA );
         dataSetService.addLockException( lockException );
 
         assertFalse( dataSetService.isLocked( dataSetA, period, unit, getDate( 2000, 4, 1 ) ) );

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/importer/DataSetImporter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/importer/DataSetImporter.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/importer/DataSetImporter.java	2013-02-08 04:20:26 +0000
@@ -35,6 +35,8 @@
 import org.hisp.dhis.importexport.Importer;
 import org.hisp.dhis.importexport.mapping.NameMappingUtil;
 
+import java.util.List;
+
 /**
  * @author Lars Helge Overland
  * @version $Id: AbstractDataSetConverter.java 4646 2008-02-26 14:54:29Z larshelg $
@@ -53,19 +55,19 @@
         this.batchHandler = batchHandler;
         this.dataSetService = dataSetService;
     }
-    
+
     @Override
     public void importObject( DataSet object, ImportParams params )
     {
         NameMappingUtil.addDataSetMapping( object.getId(), object.getName() );
-        
-        read( object, GroupMemberType.NONE, params );        
+
+        read( object, GroupMemberType.NONE, params );
     }
 
     @Override
     protected void importUnique( DataSet object )
     {
-        batchHandler.addObject( object );    
+        batchHandler.addObject( object );
     }
 
     @Override
@@ -73,20 +75,22 @@
     {
         match.setName( object.getName() );
         match.setPeriodType( object.getPeriodType() );
-        
+
         dataSetService.updateDataSet( match );
     }
 
     @Override
     protected DataSet getMatching( DataSet object )
     {
-        DataSet match = dataSetService.getDataSetByName( object.getName() );
-        
+        List<DataSet> dataSetByName = dataSetService.getDataSetByName( object.getName() );
+        DataSet match = dataSetByName.isEmpty() ? null : dataSetByName.get( 0 );
+
         if ( match == null )
         {
-            match = dataSetService.getDataSetByShortName( object.getShortName() );
+            List<DataSet> dataSetByShortName = dataSetService.getDataSetByShortName( object.getShortName() );
+            match = dataSetByShortName.isEmpty() ? null : dataSetByShortName.get( 0 );
         }
-        
+
         return match;
     }
 
@@ -101,7 +105,7 @@
         {
             return false;
         }
-        
+
         return true;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/ValidateDataSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/ValidateDataSetAction.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/ValidateDataSetAction.java	2013-02-08 04:20:26 +0000
@@ -27,9 +27,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.Collection;
-import java.util.HashSet;
-
+import com.opensymphony.xwork2.Action;
 import org.apache.commons.lang.StringEscapeUtils;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementService;
@@ -38,7 +36,8 @@
 import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.period.PeriodType;
 
-import com.opensymphony.xwork2.Action;
+import java.util.Collection;
+import java.util.HashSet;
 
 /**
  * @author Kristian
@@ -99,7 +98,7 @@
     {
         this.dataSetService = dataSetService;
     }
-    
+
     private DataElementService dataElementService;
 
     public void setDataElementService( DataElementService dataElementService )
@@ -141,8 +140,8 @@
         // ---------------------------------------------------------------------
 
         if ( name != null )
-        {   
-            DataSet match = dataSetService.getDataSetByName( name );
+        {
+            DataSet match = dataSetService.getDataSetByName( name ).get( 0 );
 
             if ( match != null && (dataSetId == null || match.getId() != dataSetId) )
             {
@@ -155,10 +154,10 @@
         // ---------------------------------------------------------------------
         // Short name
         // ---------------------------------------------------------------------
-      
+
         if ( shortName != null )
         {
-            DataSet match = dataSetService.getDataSetByShortName( shortName );
+            DataSet match = dataSetService.getDataSetByShortName( shortName ).get( 0 );
 
             if ( match != null && (dataSetId == null || match.getId() != dataSetId) )
             {
@@ -191,20 +190,20 @@
         if ( periodType != null && dataElementId != null )
         {
             PeriodType pType = PeriodType.getPeriodTypeByName( periodType );
-            
+
             for ( String id : dataElementId )
             {
                 DataElement dataElement = dataElementService.getDataElement( Integer.parseInt( id ) );
-                
+
                 if ( dataElement != null && pType != null && !pType.equals( dataElement.getPeriodType() ) )
                 {
                     message = i18n.getString( "data_element_has_other_period_type_than_data_set" ) + ": " + StringEscapeUtils.escapeHtml( dataElement.getName() );
-                    
+
                     return ERROR;
                 }
             }
         }
-        
+
         message = "OK";
 
         return SUCCESS;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/addDataSet.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/addDataSet.js	2011-08-19 21:33:57 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/addDataSet.js	2013-02-08 04:20:26 +0000
@@ -9,7 +9,7 @@
 		'rules' : getValidationRules("dataSet")
 	});
 
-	checkValueIsExist("name", "validateDataSet.action");
-	checkValueIsExist("shortName", "validateDataSet.action");
+	// checkValueIsExist("name", "validateDataSet.action");
+	// checkValueIsExist("shortName", "validateDataSet.action");
 	checkValueIsExist("code", "validateDataSet.action");
 });

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/editDataSet.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/editDataSet.js	2011-08-19 21:33:57 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/editDataSet.js	2013-02-08 04:20:26 +0000
@@ -9,6 +9,7 @@
 		'rules' : getValidationRules("dataSet")
 	});
 
+    /*
 	checkValueIsExist("name", "validateDataSet.action", {
 		dataSetId : function() {
 			return jQuery("#dataSetId").val();
@@ -20,6 +21,7 @@
 			return jQuery("#dataSetId").val();
 		}
 	});
+    */
 
 	checkValueIsExist("code", "validateDataSet.action", {
 		dataSetId : function() {