dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #11788
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3451: Changed MinMaxDataElement from Source to OrganisationUnit
------------------------------------------------------------
revno: 3451
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-04-22 20:56:19 +0200
message:
Changed MinMaxDataElement from Source to OrganisationUnit
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/minmax/MinMaxDataElement.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/minmax/MinMaxDataElementService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/minmax/MinMaxDataElementStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/minmax/DefaultMinMaxDataElementService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/minmax/MinMaxDataElementDeletionHandler.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/minmax/hibernate/HibernateMinMaxDataElementStore.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/minmax/hibernate/MinMaxDataElement.hbm.xml
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/minmax/MinMaxDataElementStoreTest.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/minmax/MinMaxDataElement.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/minmax/MinMaxDataElement.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/minmax/MinMaxDataElement.java 2011-04-22 18:56:19 +0000
@@ -31,7 +31,7 @@
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.source.Source;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
/**
* @author Kristian Nordal
@@ -42,7 +42,7 @@
{
private int id;
- private Source source;
+ private OrganisationUnit source;
private DataElement dataElement;
@@ -62,7 +62,7 @@
{
}
- public MinMaxDataElement( Source source, DataElement dataElement, DataElementCategoryOptionCombo optionCombo, int min, int max,
+ public MinMaxDataElement( OrganisationUnit source, DataElement dataElement, DataElementCategoryOptionCombo optionCombo, int min, int max,
boolean generated )
{
this.source = source;
@@ -138,12 +138,12 @@
this.id = id;
}
- public Source getSource()
+ public OrganisationUnit getSource()
{
return source;
}
- public void setSource( Source source )
+ public void setSource( OrganisationUnit source )
{
this.source = source;
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/minmax/MinMaxDataElementService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/minmax/MinMaxDataElementService.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/minmax/MinMaxDataElementService.java 2011-04-22 18:56:19 +0000
@@ -31,7 +31,7 @@
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.source.Source;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
/**
* @author Lars Helge Overland
@@ -49,11 +49,11 @@
MinMaxDataElement getMinMaxDataElement( int id );
- MinMaxDataElement getMinMaxDataElement( Source source, DataElement dataElement, DataElementCategoryOptionCombo optionCombo );
+ MinMaxDataElement getMinMaxDataElement( OrganisationUnit source, DataElement dataElement, DataElementCategoryOptionCombo optionCombo );
- Collection<MinMaxDataElement> getMinMaxDataElements( Source source, DataElement dataElement );
+ Collection<MinMaxDataElement> getMinMaxDataElements( OrganisationUnit source, DataElement dataElement );
- Collection<MinMaxDataElement> getMinMaxDataElements( Source source, Collection<DataElement> dataElements );
+ Collection<MinMaxDataElement> getMinMaxDataElements( OrganisationUnit source, Collection<DataElement> dataElements );
Collection<MinMaxDataElement> getAllMinMaxDataElements();
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/minmax/MinMaxDataElementStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/minmax/MinMaxDataElementStore.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/minmax/MinMaxDataElementStore.java 2011-04-22 18:56:19 +0000
@@ -32,7 +32,7 @@
import org.hisp.dhis.common.GenericStore;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.source.Source;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
/**
* @author Kristian Nordal
@@ -43,9 +43,9 @@
{
String ID = MinMaxDataElementStore.class.getName();
- MinMaxDataElement get( Source source, DataElement dataElement, DataElementCategoryOptionCombo optionCombo );
+ MinMaxDataElement get( OrganisationUnit source, DataElement dataElement, DataElementCategoryOptionCombo optionCombo );
- Collection<MinMaxDataElement> get( Source source, DataElement dataElement );
+ Collection<MinMaxDataElement> get( OrganisationUnit source, DataElement dataElement );
- Collection<MinMaxDataElement> get( Source source, Collection<DataElement> dataElements );
+ Collection<MinMaxDataElement> get( OrganisationUnit source, Collection<DataElement> dataElements );
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/minmax/DefaultMinMaxDataElementService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/minmax/DefaultMinMaxDataElementService.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/minmax/DefaultMinMaxDataElementService.java 2011-04-22 18:56:19 +0000
@@ -31,7 +31,7 @@
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.source.Source;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.springframework.transaction.annotation.Transactional;
/**
@@ -77,17 +77,17 @@
return minMaxDataElementStore.get( id );
}
- public MinMaxDataElement getMinMaxDataElement( Source source, DataElement dataElement, DataElementCategoryOptionCombo optionCombo )
+ public MinMaxDataElement getMinMaxDataElement( OrganisationUnit source, DataElement dataElement, DataElementCategoryOptionCombo optionCombo )
{
return minMaxDataElementStore.get( source, dataElement, optionCombo );
}
- public Collection<MinMaxDataElement> getMinMaxDataElements( Source source, DataElement dataElement )
+ public Collection<MinMaxDataElement> getMinMaxDataElements( OrganisationUnit source, DataElement dataElement )
{
return minMaxDataElementStore.get( source, dataElement );
}
- public Collection<MinMaxDataElement> getMinMaxDataElements( Source source, Collection<DataElement> dataElements )
+ public Collection<MinMaxDataElement> getMinMaxDataElements( OrganisationUnit source, Collection<DataElement> dataElements )
{
return minMaxDataElementStore.get( source, dataElements );
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/minmax/MinMaxDataElementDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/minmax/MinMaxDataElementDeletionHandler.java 2010-05-17 22:46:17 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/minmax/MinMaxDataElementDeletionHandler.java 2011-04-22 18:56:19 +0000
@@ -28,7 +28,7 @@
*/
import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.source.Source;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.system.deletion.DeletionHandler;
/**
@@ -72,7 +72,7 @@
}
@Override
- public void deleteSource( Source source )
+ public void deleteOrganisationUnit( OrganisationUnit source )
{
for ( MinMaxDataElement element : minMaxDataElementService.getAllMinMaxDataElements() )
{
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/minmax/hibernate/HibernateMinMaxDataElementStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/minmax/hibernate/HibernateMinMaxDataElementStore.java 2010-05-10 17:50:39 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/minmax/hibernate/HibernateMinMaxDataElementStore.java 2011-04-22 18:56:19 +0000
@@ -36,7 +36,7 @@
import org.hisp.dhis.hibernate.HibernateGenericStore;
import org.hisp.dhis.minmax.MinMaxDataElement;
import org.hisp.dhis.minmax.MinMaxDataElementStore;
-import org.hisp.dhis.source.Source;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
/**
* @author Kristian Nordal
@@ -49,7 +49,7 @@
// MinMaxDataElementStore Implementation
// -------------------------------------------------------------------------
- public MinMaxDataElement get( Source source, DataElement dataElement, DataElementCategoryOptionCombo optionCombo )
+ public MinMaxDataElement get( OrganisationUnit source, DataElement dataElement, DataElementCategoryOptionCombo optionCombo )
{
return (MinMaxDataElement) getCriteria(
Restrictions.eq( "source", source ),
@@ -58,7 +58,7 @@
}
@SuppressWarnings( "unchecked" )
- public Collection<MinMaxDataElement> get( Source source, DataElement dataElement )
+ public Collection<MinMaxDataElement> get( OrganisationUnit source, DataElement dataElement )
{
return getCriteria(
Restrictions.eq( "source", source ),
@@ -66,7 +66,7 @@
}
@SuppressWarnings( "unchecked" )
- public Collection<MinMaxDataElement> get( Source source, Collection<DataElement> dataElements )
+ public Collection<MinMaxDataElement> get( OrganisationUnit source, Collection<DataElement> dataElements )
{
if ( dataElements.size() == 0 )
{
=== 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 2011-04-22 18:38:43 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2011-04-22 18:56:19 +0000
@@ -271,6 +271,7 @@
executeSql( "ALTER TABLE datasetsource DROP CONSTRAINT fk766ae2938fd8026a" );
executeSql( "ALTER TABLE datasetlocksource DROP CONSTRAINT fk582fdf7e8fd8026a" );
executeSql( "ALTER TABLE completedatasetregistration DROP CONSTRAINT fk_datasetcompleteregistration_sourceid" );
+ executeSql( "ALTER TABLE minmaxdataelement DROP CONSTRAINT fk_minmaxdataelement_sourceid" );
log.info( "Tables updated" );
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/minmax/hibernate/MinMaxDataElement.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/minmax/hibernate/MinMaxDataElement.hbm.xml 2011-04-12 13:25:06 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/minmax/hibernate/MinMaxDataElement.hbm.xml 2011-04-22 18:56:19 +0000
@@ -10,7 +10,7 @@
<generator class="native" />
</id>
- <many-to-one name="source" class="org.hisp.dhis.source.Source" column="sourceid" foreign-key="fk_minmaxdataelement_sourceid"
+ <many-to-one name="source" class="org.hisp.dhis.organisationunit.OrganisationUnit" column="sourceid" foreign-key="fk_minmaxdataelement_organisationunitid"
index="index_minmaxdataelement" />
<many-to-one name="dataElement" class="org.hisp.dhis.dataelement.DataElement" column="dataelementid"
foreign-key="fk_minmaxdataelement_dataelementid" index="index_minmaxdataelement" />
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/minmax/MinMaxDataElementStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/minmax/MinMaxDataElementStoreTest.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/minmax/MinMaxDataElementStoreTest.java 2011-04-22 18:56:19 +0000
@@ -39,9 +39,8 @@
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.mock.MockSource;
-import org.hisp.dhis.source.Source;
-import org.hisp.dhis.source.SourceStore;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.junit.Test;
/**
@@ -51,20 +50,16 @@
public class MinMaxDataElementStoreTest
extends DhisSpringTest
{
- private SourceStore sourceStore;
-
- private DataElementService dataElementService;
-
private MinMaxDataElementStore minMaxDataElementStore;
@Override
public void setUpTest()
throws Exception
{
- sourceStore = (SourceStore) getBean( SourceStore.ID );
-
dataElementService = (DataElementService) getBean( DataElementService.ID );
+ organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
+
categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID );
minMaxDataElementStore = (MinMaxDataElementStore) getBean( MinMaxDataElementStore.ID );
@@ -74,11 +69,11 @@
public void testBasic()
throws Exception
{
- Source source1 = new MockSource("Source1name");
- Source source2 = new MockSource("Source2name");
+ OrganisationUnit source1 = createOrganisationUnit( 'A' );
+ OrganisationUnit source2 = createOrganisationUnit( 'B' );
- sourceStore.addSource( source1 );
- sourceStore.addSource( source2 );
+ organisationUnitService.addOrganisationUnit( source1 );
+ organisationUnitService.addOrganisationUnit( source2 );
DataElement dataElement1 = new DataElement();
dataElement1.setName( "DE1name" );