dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #02600
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 874: Removed the shortName property of DataElementCategoryOption, it was not necessary and it will mak...
------------------------------------------------------------
revno: 874
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Fri 2009-10-16 15:09:18 +0200
message:
Removed the shortName property of DataElementCategoryOption, it was not necessary and it will make handling easier. Replaced DataElementCategoryOptionStore with GenericNameStore.
removed:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementCategoryOptionStore.java
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/DataElementCategoryOptionService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryOptionService.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/dataelement/hibernate/DataElementCategoryOption.hbm.xml
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryOptionStoreTest.java
dhis-2/dhis-services/dhis-service-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementCategoryOptionBatchHandlerTest.java
dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableServiceTest.java
dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoption/AddDataElementCategoryOptionAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoption/UpdateDataElementCategoryOptionAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoption/ValidateDataElementCategoryOptionAction.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 2009-10-16 12:26:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOption.java 2009-10-16 13:09:18 +0000
@@ -56,16 +56,6 @@
this.name = name;
}
- /**
- * @param name the name.
- * @param shortName the shortname.
- */
- public DataElementCategoryOption( String name, String shortName )
- {
- this.name = name;
- this.shortName = shortName;
- }
-
// -------------------------------------------------------------------------
// hashCode, equals and toString
// -------------------------------------------------------------------------
@@ -109,6 +99,12 @@
// Getters and setters
// -------------------------------------------------------------------------
+ @Override
+ public String getShortName()
+ {
+ return name;
+ }
+
public DataElementCategory getCategory()
{
return category;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionService.java 2009-04-16 14:18:39 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionService.java 2009-10-16 13:09:18 +0000
@@ -84,14 +84,6 @@
DataElementCategoryOption getDataElementCategoryOptionByName( String name );
/**
- * Retrieves the DataElementCategoryOption with the given short name.
- *
- * @param shortName the short name of the DataElementCategoryOption to retrieve.
- * @return the DataElementCategoryOption.
- */
- DataElementCategoryOption getDataElementCategoryOptionByShortName( String shortName );
-
- /**
* Returns all DataElementCategoryOptions.
*
* @return a collection of all DataElementCategoryOptions, or an empty collection if there
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionStore.java 2009-04-16 14:18:39 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategoryOptionStore.java 1970-01-01 00:00:00 +0000
@@ -1,93 +0,0 @@
-package org.hisp.dhis.dataelement;
-
-/*
- * Copyright (c) 2004-2007, 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.Collection;
-
-/**
- * @author Jan Henrik Overland
- * @version $Id$
- */
-public interface DataElementCategoryOptionStore
-{
- String ID = DataElementCategoryOptionStore.class.getName();
-
- /**
- * Adds a DataElementCategoryOption.
- *
- * @param dataElemtnCategoryOption the DataElementCategoryOption to add.
- * @return a generated unique id of the added DataElementCategoryOption.
- */
- int addDataElementCategoryOption( DataElementCategoryOption dataElementCategoryOption );
-
- /**
- * Updates a DataElementCategoryOption.
- *
- * @param dataElementCategoryOption the DataElementCategoryOption to update.
- */
- void updateDataElementCategoryOption( DataElementCategoryOption dataElementCategoryOption );
-
- /**
- * Deletes a DataElementCategoryOption.
- *
- * @param dataElementCategoryOption
- */
- void deleteDataElementCategoryOption( DataElementCategoryOption dataElementCategoryOption );
-
- /**
- * Returns a DataElementCategoryOption.
- *
- * @param id the id of the DataElementCategoryOption to return.
- * @return the DataElementCategoryOption with the given id, or null if no match.
- */
- DataElementCategoryOption getDataElementCategoryOption( int id );
-
- /**
- * Retrieves the DataElementCategoryOption with the given name.
- *
- * @param name the name of the DataElementCategoryOption.
- * @return the DataElementCategoryOption.
- */
- DataElementCategoryOption getDataElementCategoryOptionByName( String name );
-
- /**
- * Retrieves the DataElementCategoryOption with the given short name.
- *
- * @param shortName the short name of the DataElementCategoryOption to retrieve.
- * @return the DataElementCategoryOption.
- */
- DataElementCategoryOption getDataElementCategoryOptionByShortName( String shortName );
-
- /**
- * Returns all DataElementCategoryOptions.
- *
- * @return a collection of all DataElementCategoryOptions, or an empty collection if there
- * are no DataElementCategoryOptions.
- */
- Collection<DataElementCategoryOption> getAllDataElementCategoryOptions();
-}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryOptionService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryOptionService.java 2009-06-10 22:25:07 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryOptionService.java 2009-10-16 13:09:18 +0000
@@ -30,6 +30,7 @@
import java.util.ArrayList;
import java.util.Collection;
+import org.hisp.dhis.common.GenericNameStore;
import org.hisp.dhis.i18n.I18nService;
import org.springframework.transaction.annotation.Transactional;
@@ -45,9 +46,9 @@
// Dependencies
// -------------------------------------------------------------------------
- private DataElementCategoryOptionStore dataElementCategoryOptionStore;
+ private GenericNameStore<DataElementCategoryOption> dataElementCategoryOptionStore;
- public void setDataElementCategoryOptionStore( DataElementCategoryOptionStore dataElementCategoryOptionStore )
+ public void setDataElementCategoryOptionStore( GenericNameStore<DataElementCategoryOption> dataElementCategoryOptionStore )
{
this.dataElementCategoryOptionStore = dataElementCategoryOptionStore;
}
@@ -65,7 +66,7 @@
public int addDataElementCategoryOption( DataElementCategoryOption dataElementCategoryOption )
{
- int id = dataElementCategoryOptionStore.addDataElementCategoryOption( dataElementCategoryOption );
+ int id = dataElementCategoryOptionStore.save( dataElementCategoryOption );
i18nService.addObject( dataElementCategoryOption );
@@ -74,7 +75,7 @@
public void updateDataElementCategoryOption( DataElementCategoryOption dataElementCategoryOption )
{
- dataElementCategoryOptionStore.updateDataElementCategoryOption( dataElementCategoryOption );
+ dataElementCategoryOptionStore.update( dataElementCategoryOption );
i18nService.verify( dataElementCategoryOption );
}
@@ -83,12 +84,12 @@
{
i18nService.removeObject( dataElementCategoryOption );
- dataElementCategoryOptionStore.deleteDataElementCategoryOption( dataElementCategoryOption );
+ dataElementCategoryOptionStore.delete( dataElementCategoryOption );
}
public DataElementCategoryOption getDataElementCategoryOption( int id )
{
- return dataElementCategoryOptionStore.getDataElementCategoryOption( id );
+ return dataElementCategoryOptionStore.get( id );
}
public Collection<DataElementCategoryOption> getDataElementCategoryOptions( Collection<Integer> identifiers )
@@ -110,16 +111,11 @@
public DataElementCategoryOption getDataElementCategoryOptionByName( String name )
{
- return dataElementCategoryOptionStore.getDataElementCategoryOptionByName( name );
- }
-
- public DataElementCategoryOption getDataElementCategoryOptionByShortName( String shortName )
- {
- return dataElementCategoryOptionStore.getDataElementCategoryOptionByShortName( shortName );
+ return dataElementCategoryOptionStore.getByName( name );
}
public Collection<DataElementCategoryOption> getAllDataElementCategoryOptions()
{
- return dataElementCategoryOptionStore.getAllDataElementCategoryOptions();
+ return dataElementCategoryOptionStore.getAll();
}
}
=== removed file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementCategoryOptionStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementCategoryOptionStore.java 2009-06-10 22:25:07 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementCategoryOptionStore.java 1970-01-01 00:00:00 +0000
@@ -1,118 +0,0 @@
-package org.hisp.dhis.dataelement.hibernate;
-
-/*
- * Copyright (c) 2004-2007, 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.Collection;
-
-import org.hibernate.Criteria;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.criterion.Restrictions;
-import org.hisp.dhis.dataelement.DataElementCategoryOption;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionStore;
-
-/**
- * @author Jan Henrik Overland
- * @version $Id$
- */
-public class HibernateDataElementCategoryOptionStore
- implements DataElementCategoryOptionStore
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private SessionFactory sessionFactory;
-
- public void setSessionFactory( SessionFactory sessionFactory )
- {
- this.sessionFactory = sessionFactory;
- }
-
- // -------------------------------------------------------------------------
- // DataElementCategoryOption
- // -------------------------------------------------------------------------
-
- public int addDataElementCategoryOption( DataElementCategoryOption dataElementCategoryOption )
- {
- Session session = sessionFactory.getCurrentSession();
-
- return (Integer) session.save( dataElementCategoryOption );
- }
-
- public void updateDataElementCategoryOption( DataElementCategoryOption dataElementCategoryOption )
- {
- Session session = sessionFactory.getCurrentSession();
-
- session.update( dataElementCategoryOption );
- }
-
- public void deleteDataElementCategoryOption( DataElementCategoryOption dataElementCategoryOption )
- {
- Session session = sessionFactory.getCurrentSession();
-
- session.delete( dataElementCategoryOption );
- }
-
- public DataElementCategoryOption getDataElementCategoryOption( int id )
- {
- Session session = sessionFactory.getCurrentSession();
-
- return (DataElementCategoryOption) session.get( DataElementCategoryOption.class, id );
- }
-
- public DataElementCategoryOption getDataElementCategoryOptionByName( String name )
- {
- Session session = sessionFactory.getCurrentSession();
-
- Criteria criteria = session.createCriteria( DataElementCategoryOption.class );
- criteria.add( Restrictions.eq( "name", name ) );
-
- return (DataElementCategoryOption) criteria.uniqueResult();
- }
-
- public DataElementCategoryOption getDataElementCategoryOptionByShortName( String shortName )
- {
- Session session = sessionFactory.getCurrentSession();
-
- Criteria criteria = session.createCriteria( DataElementCategoryOption.class );
- criteria.add( Restrictions.eq( "shortName", shortName ) );
-
- return (DataElementCategoryOption) criteria.uniqueResult();
- }
-
- @SuppressWarnings( "unchecked" )
- public Collection<DataElementCategoryOption> getAllDataElementCategoryOptions()
- {
- Session session = sessionFactory.getCurrentSession();
-
- Criteria criteria = session.createCriteria( DataElementCategoryOption.class );
-
- return criteria.list();
- }
-}
=== 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 2009-10-14 07:30:28 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2009-10-16 13:09:18 +0000
@@ -98,7 +98,8 @@
</bean>
<bean id="org.hisp.dhis.dataelement.DataElementCategoryOptionStore"
- class="org.hisp.dhis.dataelement.hibernate.HibernateDataElementCategoryOptionStore">
+ class="org.hisp.dhis.hibernate.HibernateGenericStore">
+ <property name="clazz" value="org.hisp.dhis.dataelement.DataElementCategoryOption"/>
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
=== 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 2009-10-16 12:26:29 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElementCategoryOption.hbm.xml 2009-10-16 13:09:18 +0000
@@ -14,8 +14,6 @@
<column name="name" not-null="true" length="160"/>
</property>
- <property name="shortName" length="40"/>
-
<property name="uuid" length="40"/>
<join table="categories_categoryoptions" inverse="true">
=== 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 2009-06-10 22:25:07 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryOptionStoreTest.java 2009-10-16 13:09:18 +0000
@@ -35,15 +35,17 @@
import java.util.Collection;
import org.hisp.dhis.DhisSpringTest;
+import org.hisp.dhis.common.GenericNameStore;
import org.junit.Test;
/**
* @author Lars Helge Overland
* @version $Id$
*/
+@SuppressWarnings( "unchecked" )
public class DataElementCategoryOptionStoreTest
extends DhisSpringTest
{
- private DataElementCategoryOptionStore categoryOptionStore;
+ private GenericNameStore<DataElementCategoryOption> categoryOptionStore;
private DataElementCategoryOption categoryOptionA;
private DataElementCategoryOption categoryOptionB;
@@ -56,7 +58,7 @@
@Override
public void setUpTest()
{
- categoryOptionStore = (DataElementCategoryOptionStore) getBean( DataElementCategoryOptionStore.ID );
+ categoryOptionStore = (GenericNameStore<DataElementCategoryOption>) getBean( "org.hisp.dhis.dataelement.DataElementCategoryOptionStore" );
}
// -------------------------------------------------------------------------
@@ -70,13 +72,13 @@
categoryOptionB = new DataElementCategoryOption( "CategoryOptionB" );
categoryOptionC = new DataElementCategoryOption( "CategoryOptionC" );
- int idA = categoryOptionStore.addDataElementCategoryOption( categoryOptionA );
- int idB = categoryOptionStore.addDataElementCategoryOption( categoryOptionB );
- int idC = categoryOptionStore.addDataElementCategoryOption( categoryOptionC );
+ int idA = categoryOptionStore.save( categoryOptionA );
+ int idB = categoryOptionStore.save( categoryOptionB );
+ int idC = categoryOptionStore.save( categoryOptionC );
- assertEquals( categoryOptionA, categoryOptionStore.getDataElementCategoryOption( idA ) );
- assertEquals( categoryOptionB, categoryOptionStore.getDataElementCategoryOption( idB ) );
- assertEquals( categoryOptionC, categoryOptionStore.getDataElementCategoryOption( idC ) );
+ assertEquals( categoryOptionA, categoryOptionStore.get( idA ) );
+ assertEquals( categoryOptionB, categoryOptionStore.get( idB ) );
+ assertEquals( categoryOptionC, categoryOptionStore.get( idC ) );
}
@Test
@@ -86,25 +88,25 @@
categoryOptionB = new DataElementCategoryOption( "CategoryOptionB" );
categoryOptionC = new DataElementCategoryOption( "CategoryOptionC" );
- int idA = categoryOptionStore.addDataElementCategoryOption( categoryOptionA );
- int idB = categoryOptionStore.addDataElementCategoryOption( categoryOptionB );
- int idC = categoryOptionStore.addDataElementCategoryOption( categoryOptionC );
-
- assertNotNull( categoryOptionStore.getDataElementCategoryOption( idA ) );
- assertNotNull( categoryOptionStore.getDataElementCategoryOption( idB ) );
- assertNotNull( categoryOptionStore.getDataElementCategoryOption( idC ) );
-
- categoryOptionStore.deleteDataElementCategoryOption( categoryOptionA );
-
- assertNull( categoryOptionStore.getDataElementCategoryOption( idA ) );
- assertNotNull( categoryOptionStore.getDataElementCategoryOption( idB ) );
- assertNotNull( categoryOptionStore.getDataElementCategoryOption( idC ) );
-
- categoryOptionStore.deleteDataElementCategoryOption( categoryOptionB );
-
- assertNull( categoryOptionStore.getDataElementCategoryOption( idA ) );
- assertNull( categoryOptionStore.getDataElementCategoryOption( idB ) );
- assertNotNull( categoryOptionStore.getDataElementCategoryOption( idC ) );
+ int idA = categoryOptionStore.save( categoryOptionA );
+ int idB = categoryOptionStore.save( categoryOptionB );
+ int idC = categoryOptionStore.save( categoryOptionC );
+
+ assertNotNull( categoryOptionStore.get( idA ) );
+ assertNotNull( categoryOptionStore.get( idB ) );
+ assertNotNull( categoryOptionStore.get( idC ) );
+
+ categoryOptionStore.delete( categoryOptionA );
+
+ assertNull( categoryOptionStore.get( idA ) );
+ assertNotNull( categoryOptionStore.get( idB ) );
+ assertNotNull( categoryOptionStore.get( idC ) );
+
+ categoryOptionStore.delete( categoryOptionB );
+
+ assertNull( categoryOptionStore.get( idA ) );
+ assertNull( categoryOptionStore.get( idB ) );
+ assertNotNull( categoryOptionStore.get( idC ) );
}
@Test
@@ -114,11 +116,11 @@
categoryOptionB = new DataElementCategoryOption( "CategoryOptionB" );
categoryOptionC = new DataElementCategoryOption( "CategoryOptionC" );
- categoryOptionStore.addDataElementCategoryOption( categoryOptionA );
- categoryOptionStore.addDataElementCategoryOption( categoryOptionB );
- categoryOptionStore.addDataElementCategoryOption( categoryOptionC );
+ categoryOptionStore.save( categoryOptionA );
+ categoryOptionStore.save( categoryOptionB );
+ categoryOptionStore.save( categoryOptionC );
- Collection<DataElementCategoryOption> categoryOptions = categoryOptionStore.getAllDataElementCategoryOptions();
+ Collection<DataElementCategoryOption> categoryOptions = categoryOptionStore.getAll();
assertEquals( 4, categoryOptions.size() ); // Including default
assertTrue( categoryOptions.contains( categoryOptionA ) );
=== modified file 'dhis-2/dhis-services/dhis-service-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementCategoryOptionBatchHandlerTest.java'
--- dhis-2/dhis-services/dhis-service-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementCategoryOptionBatchHandlerTest.java 2009-08-12 21:06:37 +0000
+++ dhis-2/dhis-services/dhis-service-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementCategoryOptionBatchHandlerTest.java 2009-10-16 13:09:18 +0000
@@ -77,8 +77,8 @@
batchHandler.init();
- categoryOptionA = new DataElementCategoryOption( "CategoryOptionA", UUID );
- categoryOptionB = new DataElementCategoryOption( "CategoryOptionB", UUID );
+ categoryOptionA = new DataElementCategoryOption( "CategoryOptionA" );
+ categoryOptionB = new DataElementCategoryOption( "CategoryOptionB" );
categoryOptionC = new DataElementCategoryOption( "CategoryOptionC" );
}
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableServiceTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableServiceTest.java 2009-08-12 21:06:37 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableServiceTest.java 2009-10-16 13:09:18 +0000
@@ -170,8 +170,8 @@
// Setup Dimensions
// ---------------------------------------------------------------------
- categoryOptionA = new DataElementCategoryOption( "Male", "Male" );
- categoryOptionB = new DataElementCategoryOption( "Female", "Female" );
+ categoryOptionA = new DataElementCategoryOption( "Male" );
+ categoryOptionB = new DataElementCategoryOption( "Female" );
categoryOptionService.addDataElementCategoryOption( categoryOptionA );
categoryOptionService.addDataElementCategoryOption( categoryOptionB );
=== 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 2009-10-13 20:08:57 +0000
+++ dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java 2009-10-16 13:09:18 +0000
@@ -406,7 +406,7 @@
for ( char identifier : categoryOptionUniqueIdentifiers )
{
- categoryOptionCombo.getCategoryOptions().add( new DataElementCategoryOption( "CategoryOption" + identifier, "CategoryOption" + identifier ) );
+ categoryOptionCombo.getCategoryOptions().add( new DataElementCategoryOption( "CategoryOption" + identifier ) );
}
return categoryOptionCombo;
@@ -852,8 +852,7 @@
this.locationManager = locationManager;
setDependency( locationManager, "externalDir", EXT_TEST_DIR, String.class );
- }
-
+ }
/**
* Attempts to remove the external test directory.
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoption/AddDataElementCategoryOptionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoption/AddDataElementCategoryOptionAction.java 2009-08-20 08:17:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoption/AddDataElementCategoryOptionAction.java 2009-10-16 13:09:18 +0000
@@ -61,13 +61,6 @@
this.name = name;
}
- private String shortName;
-
- public void setShortName( String shortName )
- {
- this.shortName = shortName;
- }
-
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -77,7 +70,6 @@
DataElementCategoryOption dataElementCategoryOption = new DataElementCategoryOption();
dataElementCategoryOption.setName( name );
- dataElementCategoryOption.setShortName( shortName );
dataElementCategoryOptionService.addDataElementCategoryOption( dataElementCategoryOption );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoption/UpdateDataElementCategoryOptionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoption/UpdateDataElementCategoryOptionAction.java 2009-08-20 08:17:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoption/UpdateDataElementCategoryOptionAction.java 2009-10-16 13:09:18 +0000
@@ -68,13 +68,6 @@
this.name = name;
}
- private String shortName;
-
- public void setShortName( String shortName )
- {
- this.shortName = shortName;
- }
-
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -85,7 +78,6 @@
.getDataElementCategoryOption( id );
dataElementCategoryOption.setName( name );
- dataElementCategoryOption.setShortName( shortName );
dataElementCategoryOptionService.updateDataElementCategoryOption( dataElementCategoryOption );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoption/ValidateDataElementCategoryOptionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoption/ValidateDataElementCategoryOptionAction.java 2009-08-20 08:17:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/categoryoption/ValidateDataElementCategoryOptionAction.java 2009-10-16 13:09:18 +0000
@@ -128,34 +128,6 @@
}
}
- if ( shortName == null )
- {
- message = i18n.getString( "specify_short_name" );
-
- return INPUT;
- }
- else
- {
- shortName = shortName.trim();
-
- if ( shortName.length() == 0 )
- {
- message = i18n.getString( "specify_short_name" );
-
- return INPUT;
- }
-
- DataElementCategoryOption match = dataElementCategoryOptionService
- .getDataElementCategoryOptionByShortName( shortName );
-
- if ( match != null && (id == null || match.getId() != id) )
- {
- message = i18n.getString( "short_name_in_use" );
-
- return INPUT;
- }
- }
-
// ---------------------------------------------------------------------
// Validation success
// ---------------------------------------------------------------------