dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #02750
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 908: Renamed and improved GenericNameStore to GenericIdentifiableObjectStore.
------------------------------------------------------------
revno: 908
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Tue 2009-10-27 16:12:01 +0100
message:
Renamed and improved GenericNameStore to GenericIdentifiableObjectStore.
renamed:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericNameStore.java => dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericIdentifiableObjectStore.java
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/ReportExcel.java
dhis-2/dhis-options/src/main/java/org/hisp/dhis/options/setting/DefaultSystemSettingManager.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datadictionary/DefaultDataDictionaryService.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/validation/DefaultValidationRuleService.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryComboStoreTest.java
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/DataElementCategoryStoreTest.java
dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/impl/DefaultDataMartExportService.java
dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartExportStoreTest.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/document/impl/DefaultDocumentService.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/olap/DefaultOlapURLService.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java
dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/document/DocumentStoreTest.java
dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/olap/OlapURLStoreTest.java
dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableStoreTest.java
dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericIdentifiableObjectStore.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.
=== renamed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericNameStore.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/GenericNameStore.java 2009-06-19 13:23:57 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericIdentifiableObjectStore.java 2009-10-27 15:12:01 +0000
@@ -31,14 +31,46 @@
* @author Lars Helge Overland
* @version $Id$
*/
-public interface GenericNameStore<T>
+public interface GenericIdentifiableObjectStore<T>
extends GenericStore<T>
{
/**
+ * 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 name.
*
* @param name the name.
* @return the object with the given name.
*/
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.
+ * @return the object with the given code.
+ */
+ T getByCode( String code );
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/ReportExcel.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/ReportExcel.java 2009-10-26 15:39:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/ReportExcel.java 2009-10-27 15:12:01 +0000
@@ -29,13 +29,10 @@
import java.util.HashSet;
import java.util.Set;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.w3c.dom.Document;
-import org.w3c.dom.Element;
/**
* @author Tran Thanh Tri
=== modified file 'dhis-2/dhis-options/src/main/java/org/hisp/dhis/options/setting/DefaultSystemSettingManager.java'
--- dhis-2/dhis-options/src/main/java/org/hisp/dhis/options/setting/DefaultSystemSettingManager.java 2009-06-19 13:23:57 +0000
+++ dhis-2/dhis-options/src/main/java/org/hisp/dhis/options/setting/DefaultSystemSettingManager.java 2009-10-27 15:12:01 +0000
@@ -31,7 +31,7 @@
import java.util.Collection;
import java.util.SortedMap;
-import org.hisp.dhis.common.GenericNameStore;
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
import org.hisp.dhis.options.SystemSetting;
import org.hisp.dhis.options.SystemSettingManager;
import org.springframework.transaction.annotation.Transactional;
@@ -49,9 +49,9 @@
// Dependencies
// -------------------------------------------------------------------------
- private GenericNameStore<SystemSetting> systemSettingStore;
+ private GenericIdentifiableObjectStore<SystemSetting> systemSettingStore;
- public void setSystemSettingStore( GenericNameStore<SystemSetting> systemSettingStore )
+ public void setSystemSettingStore( GenericIdentifiableObjectStore<SystemSetting> systemSettingStore )
{
this.systemSettingStore = systemSettingStore;
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datadictionary/DefaultDataDictionaryService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datadictionary/DefaultDataDictionaryService.java 2009-06-20 14:26:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datadictionary/DefaultDataDictionaryService.java 2009-10-27 15:12:01 +0000
@@ -30,7 +30,7 @@
import java.util.ArrayList;
import java.util.Collection;
-import org.hisp.dhis.common.GenericNameStore;
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
import org.hisp.dhis.i18n.I18nService;
import org.springframework.transaction.annotation.Transactional;
@@ -46,9 +46,9 @@
// Dependencies
// -------------------------------------------------------------------------
- private GenericNameStore<DataDictionary> dataDictionaryStore;
+ private GenericIdentifiableObjectStore<DataDictionary> dataDictionaryStore;
- public void setDataDictionaryStore( GenericNameStore<DataDictionary> dataDictionaryStore )
+ public void setDataDictionaryStore( GenericIdentifiableObjectStore<DataDictionary> dataDictionaryStore )
{
this.dataDictionaryStore = dataDictionaryStore;
}
=== 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 2009-10-20 12:49:32 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementCategoryService.java 2009-10-27 15:12:01 +0000
@@ -37,10 +37,10 @@
import java.util.Set;
import org.apache.commons.collections.CollectionUtils;
-import org.hisp.dhis.common.GenericNameStore;
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
import org.hisp.dhis.common.GenericStore;
+import org.hisp.dhis.i18n.I18nService;
import org.hisp.dhis.system.util.UUIdUtils;
-import org.hisp.dhis.i18n.I18nService;
import org.springframework.transaction.annotation.Transactional;
/**
@@ -55,9 +55,9 @@
// Dependencies
// -------------------------------------------------------------------------
- private GenericNameStore<DataElementCategory> dataElementCategoryStore;
+ private GenericIdentifiableObjectStore<DataElementCategory> dataElementCategoryStore;
- public void setDataElementCategoryStore( GenericNameStore<DataElementCategory> dataElementCategoryStore )
+ public void setDataElementCategoryStore( GenericIdentifiableObjectStore<DataElementCategory> dataElementCategoryStore )
{
this.dataElementCategoryStore = dataElementCategoryStore;
}
@@ -69,9 +69,9 @@
this.dataElementCategoryOptionStore = dataElementCategoryOptionStore;
}
- private GenericNameStore<DataElementCategoryCombo> dataElementCategoryComboStore;
+ private GenericIdentifiableObjectStore<DataElementCategoryCombo> dataElementCategoryComboStore;
- public void setDataElementCategoryComboStore( GenericNameStore<DataElementCategoryCombo> dataElementCategoryComboStore )
+ public void setDataElementCategoryComboStore( GenericIdentifiableObjectStore<DataElementCategoryCombo> dataElementCategoryComboStore )
{
this.dataElementCategoryComboStore = dataElementCategoryComboStore;
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java 2009-07-03 10:03:22 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java 2009-10-27 15:12:01 +0000
@@ -35,7 +35,7 @@
import java.util.HashSet;
import org.apache.commons.collections.CollectionUtils;
-import org.hisp.dhis.common.GenericNameStore;
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.expression.ExpressionService;
@@ -57,16 +57,16 @@
// Dependencies
// -------------------------------------------------------------------------
- private GenericNameStore<ValidationRule> validationRuleStore;
+ private GenericIdentifiableObjectStore<ValidationRule> validationRuleStore;
- public void setValidationRuleStore( GenericNameStore<ValidationRule> validationRuleStore )
+ public void setValidationRuleStore( GenericIdentifiableObjectStore<ValidationRule> validationRuleStore )
{
this.validationRuleStore = validationRuleStore;
}
- private GenericNameStore<ValidationRuleGroup> validationRuleGroupStore;
+ private GenericIdentifiableObjectStore<ValidationRuleGroup> validationRuleGroupStore;
- public void setValidationRuleGroupStore( GenericNameStore<ValidationRuleGroup> validationRuleGroupStore )
+ public void setValidationRuleGroupStore( GenericIdentifiableObjectStore<ValidationRuleGroup> validationRuleGroupStore )
{
this.validationRuleGroupStore = validationRuleGroupStore;
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryComboStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryComboStoreTest.java 2009-10-13 20:08:57 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryComboStoreTest.java 2009-10-27 15:12:01 +0000
@@ -27,17 +27,19 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertNull;
+import static junit.framework.Assert.assertTrue;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-
import org.hisp.dhis.DhisSpringTest;
-import org.hisp.dhis.common.GenericNameStore;
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
import org.junit.Test;
-import static junit.framework.Assert.*;
-
/**
* @author Lars Helge Overland
* @version $Id$
@@ -46,7 +48,7 @@
public class DataElementCategoryComboStoreTest
extends DhisSpringTest
{
- private GenericNameStore<DataElementCategoryCombo> categoryComboStore;
+ private GenericIdentifiableObjectStore<DataElementCategoryCombo> categoryComboStore;
private DataElementCategoryCombo categoryComboA;
private DataElementCategoryCombo categoryComboB;
@@ -65,7 +67,7 @@
@Override
public void setUpTest()
{
- categoryComboStore = (GenericNameStore<DataElementCategoryCombo>) getBean( "org.hisp.dhis.dataelement.DataElementCategoryComboStore" );
+ categoryComboStore = (GenericIdentifiableObjectStore<DataElementCategoryCombo>) getBean( "org.hisp.dhis.dataelement.DataElementCategoryComboStore" );
categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID );
=== 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-10-16 13:09:18 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryOptionStoreTest.java 2009-10-27 15:12:01 +0000
@@ -35,7 +35,7 @@
import java.util.Collection;
import org.hisp.dhis.DhisSpringTest;
-import org.hisp.dhis.common.GenericNameStore;
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
import org.junit.Test;
/**
* @author Lars Helge Overland
@@ -45,7 +45,7 @@
public class DataElementCategoryOptionStoreTest
extends DhisSpringTest
{
- private GenericNameStore<DataElementCategoryOption> categoryOptionStore;
+ private GenericIdentifiableObjectStore<DataElementCategoryOption> categoryOptionStore;
private DataElementCategoryOption categoryOptionA;
private DataElementCategoryOption categoryOptionB;
@@ -58,7 +58,7 @@
@Override
public void setUpTest()
{
- categoryOptionStore = (GenericNameStore<DataElementCategoryOption>) getBean( "org.hisp.dhis.dataelement.DataElementCategoryOptionStore" );
+ categoryOptionStore = (GenericIdentifiableObjectStore<DataElementCategoryOption>) getBean( "org.hisp.dhis.dataelement.DataElementCategoryOptionStore" );
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryStoreTest.java 2009-10-18 22:44:41 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/dataelement/DataElementCategoryStoreTest.java 2009-10-27 15:12:01 +0000
@@ -37,7 +37,7 @@
import java.util.List;
import org.hisp.dhis.DhisSpringTest;
-import org.hisp.dhis.common.GenericNameStore;
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
import org.junit.Test;
/**
@@ -48,7 +48,7 @@
public class DataElementCategoryStoreTest
extends DhisSpringTest
{
- private GenericNameStore<DataElementCategory> categoryStore;
+ private GenericIdentifiableObjectStore<DataElementCategory> categoryStore;
private DataElementCategoryOption categoryOptionA;
private DataElementCategoryOption categoryOptionB;
@@ -69,7 +69,7 @@
{
categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID );
- categoryStore = (GenericNameStore<DataElementCategory>) getBean( "org.hisp.dhis.dataelement.DataElementCategoryStore" );
+ categoryStore = (GenericIdentifiableObjectStore<DataElementCategory>) getBean( "org.hisp.dhis.dataelement.DataElementCategoryStore" );
categoryOptionA = new DataElementCategoryOption( "CategoryOptionA" );
categoryOptionB = new DataElementCategoryOption( "CategoryOptionB" );
=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/impl/DefaultDataMartExportService.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/impl/DefaultDataMartExportService.java 2009-07-06 17:30:19 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/impl/DefaultDataMartExportService.java 2009-10-27 15:12:01 +0000
@@ -29,7 +29,7 @@
import java.util.Collection;
-import org.hisp.dhis.common.GenericNameStore;
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
import org.hisp.dhis.datamart.DataMartExport;
import org.hisp.dhis.datamart.DataMartExportService;
import org.springframework.transaction.annotation.Transactional;
@@ -46,9 +46,9 @@
// Dependencies
// -------------------------------------------------------------------------
- private GenericNameStore<DataMartExport> dataMartExportStore;
+ private GenericIdentifiableObjectStore<DataMartExport> dataMartExportStore;
- public void setDataMartExportStore( GenericNameStore<DataMartExport> dataMartExportStore )
+ public void setDataMartExportStore( GenericIdentifiableObjectStore<DataMartExport> dataMartExportStore )
{
this.dataMartExportStore = dataMartExportStore;
}
=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartExportStoreTest.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartExportStoreTest.java 2009-06-19 13:23:57 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartExportStoreTest.java 2009-10-27 15:12:01 +0000
@@ -37,7 +37,7 @@
import java.util.Set;
import org.hisp.dhis.DhisSpringTest;
-import org.hisp.dhis.common.GenericNameStore;
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.indicator.Indicator;
@@ -58,7 +58,7 @@
public class DataMartExportStoreTest
extends DhisSpringTest
{
- private GenericNameStore<DataMartExport> dataMartExportStore;
+ private GenericIdentifiableObjectStore<DataMartExport> dataMartExportStore;
private DataMartExport exportA;
private DataMartExport exportB;
@@ -76,7 +76,7 @@
@Override
public void setUpTest()
{
- dataMartExportStore = (GenericNameStore<DataMartExport>) getBean( "org.hisp.dhis.datamart.DataMartExportStore" );
+ dataMartExportStore = (GenericIdentifiableObjectStore<DataMartExport>) getBean( "org.hisp.dhis.datamart.DataMartExportStore" );
dataElementService = (DataElementService) getBean( DataElementService.ID );
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/document/impl/DefaultDocumentService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/document/impl/DefaultDocumentService.java 2009-06-19 13:23:57 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/document/impl/DefaultDocumentService.java 2009-10-27 15:12:01 +0000
@@ -29,7 +29,7 @@
import java.util.Collection;
-import org.hisp.dhis.common.GenericNameStore;
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
import org.hisp.dhis.document.Document;
import org.hisp.dhis.document.DocumentService;
import org.springframework.transaction.annotation.Transactional;
@@ -46,9 +46,9 @@
// Dependencies
// -------------------------------------------------------------------------
- private GenericNameStore<Document> documentStore;
+ private GenericIdentifiableObjectStore<Document> documentStore;
- public void setDocumentStore( GenericNameStore<Document> documentStore )
+ public void setDocumentStore( GenericIdentifiableObjectStore<Document> documentStore )
{
this.documentStore = documentStore;
}
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/olap/DefaultOlapURLService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/olap/DefaultOlapURLService.java 2009-06-19 13:23:57 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/olap/DefaultOlapURLService.java 2009-10-27 15:12:01 +0000
@@ -30,7 +30,7 @@
import java.util.ArrayList;
import java.util.Collection;
-import org.hisp.dhis.common.GenericNameStore;
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
import org.springframework.transaction.annotation.Transactional;
/**
@@ -47,9 +47,9 @@
// Dependencies
// -------------------------------------------------------------------------
- private GenericNameStore<OlapURL> olapURLStore;
+ private GenericIdentifiableObjectStore<OlapURL> olapURLStore;
- public void setOlapURLStore( GenericNameStore<OlapURL> olapURLStore )
+ public void setOlapURLStore( GenericIdentifiableObjectStore<OlapURL> olapURLStore )
{
this.olapURLStore = olapURLStore;
}
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java 2009-10-06 00:20:18 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java 2009-10-27 15:12:01 +0000
@@ -27,6 +27,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static org.hisp.dhis.system.util.ConversionUtils.getIdentifiers;
+
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
@@ -38,7 +40,7 @@
import org.amplecode.quick.BatchHandlerFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.hisp.dhis.common.GenericNameStore;
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.completeness.DataSetCompletenessService;
import org.hisp.dhis.dataelement.DataElement;
@@ -66,8 +68,6 @@
import org.hisp.dhis.system.grid.Grid;
import org.springframework.transaction.annotation.Transactional;
-import static org.hisp.dhis.system.util.ConversionUtils.getIdentifiers;
-
/**
* @author Lars Helge Overland
* @version $Id$
@@ -93,9 +93,9 @@
this.reportTableManager = reportTableManager;
}
- private GenericNameStore<ReportTable> reportTableStore;
+ private GenericIdentifiableObjectStore<ReportTable> reportTableStore;
- public void setReportTableStore( GenericNameStore<ReportTable> reportTableStore )
+ public void setReportTableStore( GenericIdentifiableObjectStore<ReportTable> reportTableStore )
{
this.reportTableStore = reportTableStore;
}
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/document/DocumentStoreTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/document/DocumentStoreTest.java 2009-06-19 13:23:57 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/document/DocumentStoreTest.java 2009-10-27 15:12:01 +0000
@@ -27,14 +27,17 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertNull;
+import static junit.framework.Assert.assertTrue;
+
import java.util.Collection;
import org.hisp.dhis.DhisSpringTest;
-import org.hisp.dhis.common.GenericNameStore;
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
import org.junit.Test;
-import static junit.framework.Assert.*;
-
/**
* @author Lars Helge Overland
* @version $Id$
@@ -43,7 +46,7 @@
public class DocumentStoreTest
extends DhisSpringTest
{
- private GenericNameStore<Document> documentStore;
+ private GenericIdentifiableObjectStore<Document> documentStore;
private Document documentA;
private Document documentB;
@@ -52,7 +55,7 @@
@Override
public void setUpTest()
{
- documentStore = (GenericNameStore<Document>) getBean( "org.hisp.dhis.document.DocumentStore" );
+ documentStore = (GenericIdentifiableObjectStore<Document>) getBean( "org.hisp.dhis.document.DocumentStore" );
documentA = new Document( "DocumentA", "UrlA", true );
documentB = new Document( "DocumentB", "UrlB", true );
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/olap/OlapURLStoreTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/olap/OlapURLStoreTest.java 2009-06-19 13:23:57 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/olap/OlapURLStoreTest.java 2009-10-27 15:12:01 +0000
@@ -35,7 +35,7 @@
import java.util.Collection;
import org.hisp.dhis.DhisSpringTest;
-import org.hisp.dhis.common.GenericNameStore;
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
import org.junit.Test;
/**
@@ -46,7 +46,7 @@
public class OlapURLStoreTest
extends DhisSpringTest
{
- private GenericNameStore<OlapURL> olapURLStore;
+ private GenericIdentifiableObjectStore<OlapURL> olapURLStore;
// -------------------------------------------------------------------------
// Fixture
@@ -55,7 +55,7 @@
@Override
public void setUpTest()
{
- olapURLStore = (GenericNameStore<OlapURL>) getBean( "org.hisp.dhis.olap.OlapURLStore" );
+ olapURLStore = (GenericIdentifiableObjectStore<OlapURL>) getBean( "org.hisp.dhis.olap.OlapURLStore" );
}
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableStoreTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableStoreTest.java 2009-06-19 13:23:57 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/reporttable/ReportTableStoreTest.java 2009-10-27 15:12:01 +0000
@@ -37,7 +37,7 @@
import java.util.List;
import org.hisp.dhis.DhisSpringTest;
-import org.hisp.dhis.common.GenericNameStore;
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
import org.hisp.dhis.dataelement.DataElementService;
@@ -64,7 +64,7 @@
public class ReportTableStoreTest
extends DhisSpringTest
{
- private GenericNameStore<ReportTable> reportTableStore;
+ private GenericIdentifiableObjectStore<ReportTable> reportTableStore;
private IndicatorType indicatorType;
@@ -109,7 +109,7 @@
relativePeriods = new ArrayList<Period>();
units = new ArrayList<OrganisationUnit>();
- reportTableStore = (GenericNameStore<ReportTable>) getBean( "org.hisp.dhis.reporttable.ReportTableStore" );
+ reportTableStore = (GenericIdentifiableObjectStore<ReportTable>) getBean( "org.hisp.dhis.reporttable.ReportTableStore" );
dataElementService = (DataElementService) getBean( DataElementService.ID );
=== 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 2009-06-19 13:23:57 +0000
+++ dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java 2009-10-27 15:12:01 +0000
@@ -35,14 +35,14 @@
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Restrictions;
-import org.hisp.dhis.common.GenericNameStore;
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
/**
* @author Lars Helge Overland
* @version $Id$
*/
public class HibernateGenericStore<T>
- implements GenericNameStore<T>
+ implements GenericIdentifiableObjectStore<T>
{
protected SessionFactory sessionFactory;
@@ -138,7 +138,7 @@
}
// -------------------------------------------------------------------------
- // GenericDao implementation
+ // GenericStore implementation
// -------------------------------------------------------------------------
public final int save( T object )
@@ -167,12 +167,32 @@
{
return (T) sessionFactory.getCurrentSession().load( getClazz(), id );
}
+
+ public final T getByUuid( String uuid )
+ {
+ return getObject( Restrictions.eq( "uuid", uuid ) );
+ }
public final T getByName( String name )
{
return getObject( Restrictions.eq( "name", name ) );
}
+ public final T getByAlternativeName( String alternativeName )
+ {
+ return getObject( Restrictions.eq( "alternativeName", alternativeName ) );
+ }
+
+ public final T getByShortName( String shortName )
+ {
+ return getObject( Restrictions.eq( "shortName", shortName ) );
+ }
+
+ public final T getByCode( String code )
+ {
+ return getObject( Restrictions.eq( "code", code ) );
+ }
+
@SuppressWarnings( "unchecked" )
public final Collection<T> getAll()
{