← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4918: Uncommitted revision 4913.

 

------------------------------------------------------------
revno: 4918
committer: Bob Jolliffe bobjolliffe@xxxxxxxxx
branch nick: dhis2
timestamp: Wed 2011-10-12 23:13:19 +0100
message:
  Uncommitted revision 4913.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.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/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOption.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryOptionServiceTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryOptionStoreTest.java
  dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/DataElementCategoryOptionBatchHandler.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/dataelement/DataElementCategoryOption.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java	2011-10-12 20:25:07 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java	2011-10-12 22:13:19 +0000
@@ -29,9 +29,9 @@
 
 import java.util.HashSet;
 import java.util.Set;
+
 import org.hisp.dhis.common.AbstractNameableObject;
 
-
 /**
  * @author Abyot Asalefew
  * @version $Id$

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java	2011-10-12 20:25:07 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryService.java	2011-10-12 22:13:19 +0000
@@ -148,14 +148,7 @@
      * @return the DataElementCategoryOption with the given name.
      */
     DataElementCategoryOption getDataElementCategoryOptionByName( String name );
-
-    /**
-     * Retrieves the DataElementCategoryOption with the given code.
-     * @param code the code.
-     * @return the DataElementCategoryOption with the given code.
-     */
-    DataElementCategoryOption getDataElementCategoryOptionByCode( String code );
-
+    
     /**
      * Returns all DataElementCategoryOptions.
      * 

=== 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 20:25:07 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java	2011-10-12 22:13:19 +0000
@@ -177,12 +177,6 @@
         return dataElementCategoryOptionStore.getByName( name );
     }
 
-    @Override
-    public DataElementCategoryOption getDataElementCategoryOptionByCode( String code )
-    {
-        return dataElementCategoryOptionStore.getByCode( code );
-    }
-
     public Collection<DataElementCategoryOption> getDataElementCategoryOptions( final Collection<Integer> identifiers )
     {
         Collection<DataElementCategoryOption> categoryOptions = getAllDataElementCategoryOptions();
@@ -550,5 +544,4 @@
     {
         return dataElementCategoryComboStore.getBetweenByName( name, first, max );
     }
-
 }

=== 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 20:25:07 +0000
+++ 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
@@ -3,21 +3,18 @@
   "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
   "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd";>
 
-<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>
-    <property name="code">
-      <column name="code" unique="true" length="160" />
+    <property name="uuid" length="40" />
+    <property name="name">
+      <column name="name" not-null="true" unique="true" length="160" />
     </property>
 
     <set name="categoryOptionCombos" table="categoryoptioncombos_categoryoptions" inverse="true">
@@ -31,6 +28,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/test/java/org/hisp/dhis/dataelement/DataElementCategoryOptionServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryOptionServiceTest.java	2011-10-12 20:25:07 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryOptionServiceTest.java	2011-10-12 22:13:19 +0000
@@ -68,28 +68,17 @@
         categoryOptionA = new DataElementCategoryOption( "CategoryOptionA" );
         categoryOptionB = new DataElementCategoryOption( "CategoryOptionB" );
         categoryOptionC = new DataElementCategoryOption( "CategoryOptionC" );
-
+        
         int idA = categoryService.addDataElementCategoryOption( categoryOptionA );
         int idB = categoryService.addDataElementCategoryOption( categoryOptionB );
         int idC = categoryService.addDataElementCategoryOption( categoryOptionC );
-
+        
         assertEquals( categoryOptionA, categoryService.getDataElementCategoryOption( idA ) );
         assertEquals( categoryOptionB, categoryService.getDataElementCategoryOption( idB ) );
         assertEquals( categoryOptionC, categoryService.getDataElementCategoryOption( idC ) );
     }
 
     @Test
-    public void testCode()
-    {
-        categoryOptionA = new DataElementCategoryOption( "CategoryOptionA" );
-        categoryOptionA.setCode( "12345");
-
-        int idA = categoryService.addDataElementCategoryOption( categoryOptionA );
-
-        assertEquals( "12345", categoryService.getDataElementCategoryOption( idA ).getCode() );
-    }
-
-    @Test
     public void testDelete()
     {
         categoryOptionA = new DataElementCategoryOption( "CategoryOptionA" );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryOptionStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryOptionStoreTest.java	2011-10-12 20:25:07 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryOptionStoreTest.java	2011-10-12 22:13:19 +0000
@@ -119,47 +119,12 @@
         categoryOptionStore.save( categoryOptionA );
         categoryOptionStore.save( categoryOptionB );
         categoryOptionStore.save( categoryOptionC );
-
+        
         Collection<DataElementCategoryOption> categoryOptions = categoryOptionStore.getAll();
-
+        
         assertEquals( 4, categoryOptions.size() ); // Including default
         assertTrue( categoryOptions.contains( categoryOptionA ) );
         assertTrue( categoryOptions.contains( categoryOptionB ) );
-        assertTrue( categoryOptions.contains( categoryOptionC ) );
-    }
-
-    @Test
-    public void testGetByCode()
-    {
-        categoryOptionA = new DataElementCategoryOption( "CategoryOptionA" );
-        categoryOptionA.setCode("CODE_RED");
-        categoryOptionB = new DataElementCategoryOption( "CategoryOptionB" );
-        categoryOptionC = new DataElementCategoryOption( "CategoryOptionC" );
-
-        categoryOptionStore.save( categoryOptionA );
-
-        categoryOptionStore.getByCode( "CODE_RED");
-
-        assertEquals( "CODE_RED", categoryOptionA.getCode() );
-        assertEquals( "CategoryOptionA", categoryOptionA.getName() );
-    }
-
-    @Test
-    public void testUniqueCode()
-    {
-        categoryOptionA = new DataElementCategoryOption( "CategoryOptionA" );
-        categoryOptionA.setCode("CODE_RED");
-        categoryOptionB = new DataElementCategoryOption( "CategoryOptionB" );
-        categoryOptionB.setCode("CODE_RED");
-
-        categoryOptionStore.save( categoryOptionA );
-
-        Exception ex = null;
-        try {
-            categoryOptionStore.save( categoryOptionB );
-        } catch (Exception ex2) { ex = ex2;}
-
-        assertEquals( "class org.hibernate.exception.ConstraintViolationException", ex.getClass().toString() );
-    }
-    
+        assertTrue( categoryOptions.contains( categoryOptionC ) );        
+    }
 }

=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/DataElementCategoryOptionBatchHandler.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/DataElementCategoryOptionBatchHandler.java	2011-10-12 20:25:07 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/DataElementCategoryOptionBatchHandler.java	2011-10-12 22:13:19 +0000
@@ -51,7 +51,6 @@
     // AbstractBatchHandler implementation
     // -------------------------------------------------------------------------
 
-    @Override
     protected void setTableName()
     {
         statementBuilder.setTableName( "dataelementcategoryoption" );
@@ -75,32 +74,24 @@
         statementBuilder.setIdentifierValue( categoryOption.getId() );
     }
     
-    @Override
     protected void setUniqueColumns()
     {
-        statementBuilder.setUniqueColumn( "code" );
         statementBuilder.setUniqueColumn( "name" );
     }
     
-    @Override
     protected void setUniqueValues( DataElementCategoryOption categoryOption )
     {        
-        statementBuilder.setUniqueValue( categoryOption.getCode() );
         statementBuilder.setUniqueValue( categoryOption.getName() );
     }
     
-    @Override
     protected void setColumns()
     {
-        statementBuilder.setColumn( "code" );
         statementBuilder.setColumn( "name" );
         statementBuilder.setColumn( "uuid" );
     }
     
-    @Override
     protected void setValues( DataElementCategoryOption categoryOption )
     {        
-        statementBuilder.setValue( categoryOption.getCode() );
         statementBuilder.setValue( categoryOption.getName() );
         statementBuilder.setValue( categoryOption.getUuid() );
     }