← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3452: Removed Source object. Using OrganisationUnit instead of Source for DataValue.

 

------------------------------------------------------------
revno: 3452
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-04-22 23:04:14 +0200
message:
  Removed Source object. Using OrganisationUnit instead of Source for DataValue.
removed:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/source/SourceStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/source/
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/source/hibernate/
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/source/hibernate/HibernateSourceStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/source/
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/source/hibernate/
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/source/hibernate/Source.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/source/
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/source/SourceStoreTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/resources/org/
  dhis-2/dhis-services/dhis-service-core/src/test/resources/org/hisp/
  dhis-2/dhis-services/dhis-service-core/src/test/resources/org/hisp/dhis/
  dhis-2/dhis-services/dhis-service-core/src/test/resources/org/hisp/dhis/source/
  dhis-2/dhis-services/dhis-service-core/src/test/resources/org/hisp/dhis/source/hibernate/
  dhis-2/dhis-services/dhis-service-core/src/test/resources/org/hisp/dhis/source/hibernate/MockSource.hbm.xml
  dhis-2/dhis-support/dhis-support-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/SourceOrganisationUnitBatchHandlerTest.java
  dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/SourceBatchHandler.java
  dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/mock/MockSource.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/datalock/DataSetLockStore.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValue.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAuditService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAuditStore.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueStore.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/expression/ExpressionService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/importexport/ImportDataValue.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitStore.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodStore.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/source/Source.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationResult.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleService.java
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataarchive/ArchivedDataValueDeletionHandler.java
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/datalock/hibernate/HibernateDataSetLockStore.java
  dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/statistics/jdbc/JdbcStatisticsProvider.java
  dhis-2/dhis-services/dhis-service-aggregationengine-default/src/test/java/org/hisp/dhis/aggregation/AggregationStoreTest.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataanalysis/MinMaxValueMap.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DataSetDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DataValueAuditDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DataValueDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueAuditService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueAuditStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupDeletionHandler.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/period/DefaultPeriodService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/period/hibernate/HibernatePeriodStore.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/java/org/hisp/dhis/startup/TableCreator.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserDeletionHandler.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/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/datavalue/hibernate/DataValue.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnit.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueDimensionTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueServiceTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueStoreTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/expression/ExpressionServiceTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/period/PeriodServiceTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/period/PeriodStoreTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleServiceTest.java
  dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/DataMartExportDeletionHandler.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/importer/DefaultDhis14FileImportService.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/OrganisationUnitRowHandler.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/RoutineDataValueRowHandler.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/SemiPermanentDataValueRowHandler.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DXFConverter.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataSetSourceAssociationConverter.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataValueConverter.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/OrganisationUnitConverter.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/service/DataSetMapper.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/importer/OrganisationUnitImporter.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/service/DefaultImportObjectManager.java
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/PatientDeletionHandler.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/ChartDeletionHandler.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/ReportTableDeletionHandler.java
  dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/ehcache.xml
  dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/OrganisationUnitBatchHandler.java
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DefaultDeletionManager.java
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java
  dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/DataSetResource.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/GetDataSetAction.java
  dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/GetValidationResultDetailsAction.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/datalock/DataSetLockStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datalock/DataSetLockStore.java	2009-09-15 03:50:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datalock/DataSetLockStore.java	2011-04-22 21:04:14 +0000
@@ -29,8 +29,8 @@
 import java.util.Collection;
 
 import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
-import org.hisp.dhis.source.Source;
 
 /**
  * @author Brajesh Murari
@@ -104,12 +104,12 @@
      * @param dataSet, period, source The DataSetLock.
      * @return The DataSetLock with the given DataSetLock.
      */   
-    DataSetLock getDataSetLockByDataSetPeriodAndSource( DataSet dataSet, Period period, Source source );
+    DataSetLock getDataSetLockByDataSetPeriodAndSource( DataSet dataSet, Period period, OrganisationUnit source );
    
     /**
      * Returns all DataSetLocks associated with the specified source.
      */
-    Collection<DataSetLock> getDataSetLocksBySource( Source source );
+    Collection<DataSetLock> getDataSetLocksBySource( OrganisationUnit source );
 
     /**
      * Get all DataSetLocks.

=== 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	2011-04-22 17:02:27 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSet.java	2011-04-22 21:04:14 +0000
@@ -37,7 +37,6 @@
 import org.hisp.dhis.dataentryform.DataEntryForm;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.PeriodType;
-import org.hisp.dhis.source.Source;
 
 /**
  * This class is used for defining the standardized DataSets. A DataSet consists
@@ -286,21 +285,6 @@
         return mobile;
     }
 
-    /**
-     * Use getSources() for persistence operations.
-     */
-    public Set<OrganisationUnit> getOrganisationUnits()
-    {
-        Set<OrganisationUnit> result = new HashSet<OrganisationUnit>();
-
-        for ( Source s : this.sources )
-        {
-            result.add( (OrganisationUnit) s );
-        }
-
-        return result;
-    }
-
     public Integer getVersion()
     {
         return version;

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValue.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValue.java	2010-11-09 21:57:28 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValue.java	2011-04-22 21:04:14 +0000
@@ -33,8 +33,8 @@
 import org.hisp.dhis.common.ImportableObject;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
-import org.hisp.dhis.source.Source;
 
 /**
  * @author Kristian Nordal
@@ -59,7 +59,7 @@
     /**
      * Part of the DataValue's composite ID
      */
-    private Source source;
+    private OrganisationUnit source;
 
     /**
      * Part of the DataValue's composite ID
@@ -84,39 +84,39 @@
     {
     }
 
-    public DataValue( DataElement dataElement, Period period, Source source )
-    {
-        this.dataElement = dataElement;
-        this.period = period;
-        this.source = source;
-    }
-
-    public DataValue( DataElement dataElement, Period period, Source source, DataElementCategoryOptionCombo optionCombo )
-    {
-        this.dataElement = dataElement;
-        this.period = period;
-        this.source = source;
-        this.optionCombo = optionCombo;
-    }
-
-    public DataValue( DataElement dataElement, Period period, Source source, String value )
-    {
-        this.dataElement = dataElement;
-        this.period = period;
-        this.source = source;
-        this.value = value;
-    }
-
-    public DataValue( DataElement dataElement, Period period, Source source, String value, DataElementCategoryOptionCombo optionCombo )
-    {
-        this.dataElement = dataElement;
-        this.period = period;
-        this.source = source;
-        this.value = value;
-        this.optionCombo = optionCombo;
-    }
-
-    public DataValue( DataElement dataElement, Period period, Source source, String value, String storedBy,
+    public DataValue( DataElement dataElement, Period period, OrganisationUnit source )
+    {
+        this.dataElement = dataElement;
+        this.period = period;
+        this.source = source;
+    }
+
+    public DataValue( DataElement dataElement, Period period, OrganisationUnit source, DataElementCategoryOptionCombo optionCombo )
+    {
+        this.dataElement = dataElement;
+        this.period = period;
+        this.source = source;
+        this.optionCombo = optionCombo;
+    }
+
+    public DataValue( DataElement dataElement, Period period, OrganisationUnit source, String value )
+    {
+        this.dataElement = dataElement;
+        this.period = period;
+        this.source = source;
+        this.value = value;
+    }
+
+    public DataValue( DataElement dataElement, Period period, OrganisationUnit source, String value, DataElementCategoryOptionCombo optionCombo )
+    {
+        this.dataElement = dataElement;
+        this.period = period;
+        this.source = source;
+        this.value = value;
+        this.optionCombo = optionCombo;
+    }
+
+    public DataValue( DataElement dataElement, Period period, OrganisationUnit source, String value, String storedBy,
         Date timestamp, String comment )
     {
         this.dataElement = dataElement;
@@ -128,7 +128,7 @@
         this.comment = comment;
     }
     
-    public DataValue( DataElement dataElement, Period period, Source source, String value, String storedBy,
+    public DataValue( DataElement dataElement, Period period, OrganisationUnit source, String value, String storedBy,
         Date timestamp, String comment, DataElementCategoryOptionCombo optionCombo )
     {
         this.dataElement = dataElement;
@@ -241,12 +241,12 @@
         this.period = period;
     }
 
-    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/datavalue/DataValueAuditService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAuditService.java	2010-06-09 10:37:45 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAuditService.java	2011-04-22 21:04:14 +0000
@@ -31,8 +31,8 @@
 
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
-import org.hisp.dhis.source.Source;
 
 /**
  * @author Quang Nguyen
@@ -49,7 +49,7 @@
 
     int deleteDataValueAuditByDataValue( DataValue dataValue );
 
-    void deleteDataValueAuditBySource( Source source );
+    void deleteDataValueAuditBySource( OrganisationUnit source );
 
     void deleteDataValueAuditByDataElement( DataElement dataElement );
 

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAuditStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAuditStore.java	2010-06-09 10:37:45 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAuditStore.java	2011-04-22 21:04:14 +0000
@@ -31,8 +31,8 @@
 
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
-import org.hisp.dhis.source.Source;
 
 /**
  * @author Quang Nguyen
@@ -48,7 +48,7 @@
 
     int deleteDataValueAuditByDataValue( DataValue dataValue );
 
-    void deleteDataValueAuditBySource( Source source );
+    void deleteDataValueAuditBySource( OrganisationUnit source );
 
     void deleteDataValueAuditByDataElement( DataElement dataElement );
 

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueService.java	2011-04-14 09:05:18 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueService.java	2011-04-22 21:04:14 +0000
@@ -35,7 +35,6 @@
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodType;
-import org.hisp.dhis.source.Source;
 
 /**
  * The DataValueService interface defines how to work with data values.
@@ -87,7 +86,7 @@
      * @param source the Source for which the DataValues should be deleted.
      * @return the number of deleted DataValues.
      */
-    int deleteDataValuesBySource( Source source );
+    int deleteDataValuesBySource( OrganisationUnit source );
 
     /**
      * Deletes all DataValues registered for the given DataElemt.
@@ -106,7 +105,7 @@
      * @return the DataValue which corresponds to the given parameters, or null
      *         if no match.
      */
-    DataValue getDataValue( Source source, DataElement dataElement, Period period, DataElementCategoryOptionCombo optionCombo );
+    DataValue getDataValue( OrganisationUnit source, DataElement dataElement, Period period, DataElementCategoryOptionCombo optionCombo );
 
     /**
      * Returns a DataValue.
@@ -138,7 +137,7 @@
      * @return a collection of all DataValues which match the given Source and
      *         Period, or an empty collection if no values match.
      */
-    Collection<DataValue> getDataValues( Source source, Period period );
+    Collection<DataValue> getDataValues( OrganisationUnit source, Period period );
 
     /**
      * Returns all DataValues for a given Source and DataElement.
@@ -148,7 +147,7 @@
      * @return a collection of all DataValues which match the given Source and
      *         DataElement, or an empty collection if no values match.
      */
-    Collection<DataValue> getDataValues( Source source, DataElement dataElement );
+    Collection<DataValue> getDataValues( OrganisationUnit source, DataElement dataElement );
 
     /**
      * Returns all DataValues for a given collection of Sources and a
@@ -160,7 +159,7 @@
      *         Sources and the DataElement, or an empty collection if no values
      *         match.
      */
-    Collection<DataValue> getDataValues( Collection<Source> sources, DataElement dataElement );
+    Collection<DataValue> getDataValues( Collection<OrganisationUnit> sources, DataElement dataElement );
     
     /**
      * Returns all DataValues for a given Source, Period, collection of
@@ -173,7 +172,7 @@
      *         Period, and any of the DataElements, or an empty collection if no
      *         values match.
      */
-    Collection<DataValue> getDataValues( Source source, Period period, Collection<DataElement> dataElements, Collection<DataElementCategoryOptionCombo> optionCombos );
+    Collection<DataValue> getDataValues( OrganisationUnit source, Period period, Collection<DataElement> dataElements, Collection<DataElementCategoryOptionCombo> optionCombos );
 
     /**
      * Returns all DataValues for a given Source, Period, and collection of
@@ -186,7 +185,7 @@
      *         Period, and any of the DataElements, or an empty collection if no
      *         values match.
      */
-    Collection<DataValue> getDataValues( Source source, Period period, Collection<DataElement> dataElements );
+    Collection<DataValue> getDataValues( OrganisationUnit source, Period period, Collection<DataElement> dataElements );
 
     /**
      * Returns all DataValues for a given DataElement, Period, and collection of 
@@ -198,7 +197,7 @@
      * @return a collection of all DataValues which match the given DataElement,
      *         Period, and Sources.
      */
-    Collection<DataValue> getDataValues( DataElement dataElement, Period period, Collection<? extends Source> sources );
+    Collection<DataValue> getDataValues( DataElement dataElement, Period period, Collection<OrganisationUnit> sources );
     
     /**
      * Returns all DataValues for a given DataElement, collection of Periods, and 
@@ -210,7 +209,7 @@
      *         Periods, and Sources.
      */
     Collection<DataValue> getDataValues( DataElement dataElement, Collection<Period> periods, 
-        Collection<? extends Source> sources );
+        Collection<OrganisationUnit> sources );
 
     /**
      * Returns all DataValues for a given DataElement, DataElementCategoryOptionCombo,
@@ -224,7 +223,7 @@
      *         Periods, and Sources.
      */
     Collection<DataValue> getDataValues( DataElement dataElement, DataElementCategoryOptionCombo optionCombo, 
-        Collection<Period> periods, Collection<? extends Source> sources );
+        Collection<Period> periods, Collection<OrganisationUnit> sources );
     
     /**
      * Returns all DataValues for a given collection of DataElementCategoryOptionCombos.

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueStore.java	2011-04-14 09:05:18 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueStore.java	2011-04-22 21:04:14 +0000
@@ -35,7 +35,6 @@
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodType;
-import org.hisp.dhis.source.Source;
 
 /**
  * Defines the functionality for persisting DataValues.
@@ -78,7 +77,7 @@
      * @param source the Source for which the DataValues should be deleted.
      * @return the number of deleted DataValues.
      */
-    int deleteDataValuesBySource( Source source );
+    int deleteDataValuesBySource( OrganisationUnit source );
     
     /**
      * Deletes all DataValues registered for the given DataElement.
@@ -97,7 +96,7 @@
      * @return the DataValue which corresponds to the given parameters, or null
      *         if no match.
      */
-    DataValue getDataValue( Source source, DataElement dataElement, Period period, DataElementCategoryOptionCombo optionCombo );
+    DataValue getDataValue( OrganisationUnit source, DataElement dataElement, Period period, DataElementCategoryOptionCombo optionCombo );
 
     /**
      * Returns a DataValue.
@@ -129,7 +128,7 @@
      * @return a collection of all DataValues which match the given Source and
      *         Period, or an empty collection if no values match.
      */
-    Collection<DataValue> getDataValues( Source source, Period period );
+    Collection<DataValue> getDataValues( OrganisationUnit source, Period period );
     
     /**
      * Returns all DataValues for a given Source and DataElement.
@@ -139,7 +138,7 @@
      * @return a collection of all DataValues which match the given Source and
      *         DataElement, or an empty collection if no values match.
      */
-    Collection<DataValue> getDataValues( Source source, DataElement dataElement );
+    Collection<DataValue> getDataValues( OrganisationUnit source, DataElement dataElement );
 
     /**
      * Returns all DataValues for a given collection of Sources and a
@@ -151,7 +150,7 @@
      *         Sources and the DataElement, or an empty collection if no values
      *         match.
      */
-    Collection<DataValue> getDataValues( Collection<? extends Source> sources, DataElement dataElement );
+    Collection<DataValue> getDataValues( Collection<OrganisationUnit> sources, DataElement dataElement );
 
     /**
      * Returns all DataValues for a given Source, Period, and collection of
@@ -164,7 +163,7 @@
      *         Period, and any of the DataElements, or an empty collection if no
      *         values match.
      */
-    Collection<DataValue> getDataValues( Source source, Period period, Collection<DataElement> dataElements );
+    Collection<DataValue> getDataValues( OrganisationUnit source, Period period, Collection<DataElement> dataElements );
     
     /**
      * Returns all DataValues for a given Source, Period, collection of
@@ -177,7 +176,7 @@
      *         Period, and any of the DataElements, or an empty collection if no
      *         values match.
      */
-    Collection<DataValue> getDataValues( Source source, Period period, Collection<DataElement> dataElements, Collection<DataElementCategoryOptionCombo> optionCombos );
+    Collection<DataValue> getDataValues( OrganisationUnit source, Period period, Collection<DataElement> dataElements, Collection<DataElementCategoryOptionCombo> optionCombos );
     
     /**
      * Returns all DataValues for a given DataElement, Period, and collection of 
@@ -189,7 +188,7 @@
      * @return a collection of all DataValues which match the given DataElement,
      *         Period, and Sources.
      */
-    Collection<DataValue> getDataValues( DataElement dataElement, Period period, Collection<? extends Source> sources );
+    Collection<DataValue> getDataValues( DataElement dataElement, Period period, Collection<OrganisationUnit> sources );
     
     /**
      * Returns all DataValues for a given DataElement, collection of Periods, and 
@@ -202,7 +201,7 @@
      *         Periods, and Sources.
      */
     Collection<DataValue> getDataValues( DataElement dataElement, Collection<Period> periods, 
-        Collection<? extends Source> sources );
+        Collection<OrganisationUnit> sources );
     
     /**
      * Returns all DataValues for a given DataElement, DataElementCategoryOptionCombo,
@@ -216,7 +215,7 @@
      *         Periods, and Sources.
      */
     Collection<DataValue> getDataValues( DataElement dataElement, DataElementCategoryOptionCombo optionCombo, 
-        Collection<Period> periods, Collection<? extends Source> sources );
+        Collection<Period> periods, Collection<OrganisationUnit> sources );
     
     /**
      * Returns all DataValues for a given collection of DataElementCategoryOptionCombos.

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/expression/ExpressionService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/expression/ExpressionService.java	2010-12-06 21:06:40 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/expression/ExpressionService.java	2011-04-22 21:04:14 +0000
@@ -33,8 +33,8 @@
 
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementOperand;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
-import org.hisp.dhis.source.Source;
 
 /**
  * Interface for ExpressionService. Defines service functionality for
@@ -110,7 +110,7 @@
      *         if no values are registered for a given combination of 
      *         DataElement, Source, and Period.
      */
-    Double getExpressionValue( Expression expression, Period period, Source source, boolean nullIfNoValues, boolean aggregate );
+    Double getExpressionValue( Expression expression, Period period, OrganisationUnit source, boolean nullIfNoValues, boolean aggregate );
     
     /**
      * Returns all DataElements included in the given expression string.
@@ -202,6 +202,6 @@
      *        used when evaluating the expression.
      * @return A numerical expression.
      */    
-    String generateExpression( String expression, Period period, Source source, boolean nullIfNoValues, boolean aggregated );
+    String generateExpression( String expression, Period period, OrganisationUnit source, boolean nullIfNoValues, boolean aggregated );
 
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/importexport/ImportDataValue.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/importexport/ImportDataValue.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/importexport/ImportDataValue.java	2011-04-22 21:04:14 +0000
@@ -35,7 +35,6 @@
 import org.hisp.dhis.datavalue.DataValue;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
-import org.hisp.dhis.source.Source;
 
 /**
  * @author Lars Helge Overland
@@ -105,7 +104,7 @@
         Period period = new Period();
         value.setPeriod( period );
         
-        Source source = new OrganisationUnit();
+        OrganisationUnit source = new OrganisationUnit();
         value.setSource( source );
         
         value.getDataElement().setId( this.dataElementId );

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java	2011-04-06 15:27:43 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java	2011-04-22 21:04:14 +0000
@@ -38,8 +38,10 @@
 import java.util.regex.Pattern;
 
 import org.apache.commons.lang.StringUtils;
+import org.hisp.dhis.common.AbstractNameableObject;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.organisationunit.comparator.OrganisationUnitNameComparator;
-import org.hisp.dhis.source.Source;
 import org.hisp.dhis.user.User;
 
 /**
@@ -47,7 +49,7 @@
  * @version $Id: OrganisationUnit.java 6251 2008-11-10 14:37:05Z larshelg $
  */
 public class OrganisationUnit
-    extends Source
+    extends AbstractNameableObject
 {
     public static final String FEATURETYPE_NONE = "None";
     public static final String FEATURETYPE_MULTIPOLYGON = "MultiPolygon";
@@ -84,6 +86,8 @@
 
     private Set<OrganisationUnitGroup> groups = new HashSet<OrganisationUnitGroup>();
     
+    private Set<DataSet> dataSets = new HashSet<DataSet>();
+    
     private Set<User> users = new HashSet<User>();
     
     private String contactPerson;
@@ -335,6 +339,18 @@
         return builder.toString();
     }
     
+    public Set<DataElement> getDataElementsInDataSets()
+    {
+        Set<DataElement> dataElements = new HashSet<DataElement>();
+        
+        for ( DataSet dataSet : dataSets )
+        {
+            dataElements.addAll( dataSet.getDataElements() );
+        }
+        
+        return dataElements;
+    }
+    
     // -------------------------------------------------------------------------
     // hashCode, equals and toString
     // -------------------------------------------------------------------------
@@ -528,6 +544,16 @@
         this.groups = groups;
     }
 
+    public Set<DataSet> getDataSets()
+    {
+        return dataSets;
+    }
+
+    public void setDataSets( Set<DataSet> dataSets )
+    {
+        this.dataSets = dataSets;
+    }
+
     public Set<User> getUsers()
     {
         return users;

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java	2011-04-22 17:45:58 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitService.java	2011-04-22 21:04:14 +0000
@@ -32,7 +32,6 @@
 import java.util.Set;
 
 import org.hisp.dhis.hierarchy.HierarchyViolationException;
-import org.hisp.dhis.source.Source;
 
 /**
  * Defines methods for working with OrganisationUnits.
@@ -218,14 +217,6 @@
      */
     Collection<OrganisationUnit> getOrganisationUnitsWithoutGroups();
     
-    
-    /**
-     * Convert the OrganisationUnit collection to the set of Source 
-     * 
-     * @return a Set with Source entries.
-     */
-    Set<Source> convert( Collection<OrganisationUnit> organisationUnits );
-    
     /**
      * Get the units which name are like the given name and are members of the
      * given groups. If name or groups are null or empty they are ignored in the 

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitStore.java	2011-03-17 20:59:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitStore.java	2011-04-22 21:04:14 +0000
@@ -29,6 +29,8 @@
 
 import java.util.Collection;
 
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
+
 /**
  * Defines methods for persisting OrganisationUnits.
  * 
@@ -36,6 +38,7 @@
  * @version $Id: OrganisationUnitStore.java 5645 2008-09-04 10:01:02Z larshelg $
  */
 public interface OrganisationUnitStore
+    extends GenericIdentifiableObjectStore<OrganisationUnit>
 {
     String ID = OrganisationUnitStore.class.getName();
 
@@ -44,22 +47,6 @@
     // -------------------------------------------------------------------------
 
     /**
-     * Returns the OrganisationUnit with the given UUID.
-     * 
-     * @param uuid the UUID of the OrganisationUnit to return.
-     * @return the OrganisationUnit with the given UUID, or null if no match.
-     */
-    OrganisationUnit getOrganisationUnit( String uuid );
-
-    /**
-     * Returns an OrganisationUnit with a given name.
-     * 
-     * @param name the name of the OrganisationUnit to return.
-     * @return the OrganisationUnit with the given name, or null if not match.
-     */
-    OrganisationUnit getOrganisationUnitByName( String name );
-
-    /**
      * Returns an OrganisationUnit with a given name. Case is ignored.
      * 
      * @param name the name of the OrganisationUnit to return.

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodService.java	2010-12-29 20:10:27 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodService.java	2011-04-22 21:04:14 +0000
@@ -33,7 +33,7 @@
 
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.i18n.I18nFormat;
-import org.hisp.dhis.source.Source;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
 
 /**
  * @author Kristian Nordal
@@ -231,7 +231,7 @@
      * @return all intersecting Periods for the given Period which have assosiated DataValues for
      *         the given collection of DataElements and Sources.
      */
-    Collection<Period> getPeriods( Period period, Collection<DataElement> dataElements, Collection<? extends Source> sources );
+    Collection<Period> getPeriods( Period period, Collection<DataElement> dataElements, Collection<OrganisationUnit> sources );
     
     /**
      * Enforces that each Period in the given collection is loaded in the current

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodStore.java	2010-07-04 10:31:31 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodStore.java	2011-04-22 21:04:14 +0000
@@ -31,7 +31,7 @@
 import java.util.Date;
 
 import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.source.Source;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
 
 /**
  * Defines the functionality for persisting Periods and PeriodTypes.
@@ -165,7 +165,7 @@
      * @return all intersecting Periods for the given Period which have assosiated DataValues for
      *         the given collection of DataElements and Sources.
      */
-    Collection<Period> getPeriods( Period period, Collection<DataElement> dataElements, Collection<? extends Source> sources );
+    Collection<Period> getPeriods( Period period, Collection<DataElement> dataElements, Collection<OrganisationUnit> sources );
     
     /**
      * Checks if the given period is associated with the current session and loads

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/source/Source.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/source/Source.java	2011-04-01 09:57:53 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/source/Source.java	2011-04-22 21:04:14 +0000
@@ -38,6 +38,7 @@
  * @author Torgeir Lorange Ostby
  * @version $Id: Source.java 5277 2008-05-27 15:48:42Z larshelg $
  */
+@Deprecated
 public abstract class Source
     extends AbstractNameableObject
 {

=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/source/SourceStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/source/SourceStore.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/source/SourceStore.java	1970-01-01 00:00:00 +0000
@@ -1,84 +0,0 @@
-package org.hisp.dhis.source;
-
-/*
- * Copyright (c) 2004-2010, 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 Torgeir Lorange Ostby
- * @version $Id: SourceStore.java 2869 2007-02-20 14:26:09Z andegje $
- */
-public interface SourceStore
-{
-    String ID = SourceStore.class.getName();
-
-    /**
-     * Adds a Source.
-     * 
-     * @param source the Source to add.
-     * @return the generated identifier.
-     */
-    <S extends Source> int addSource( S source );
-
-    /**
-     * Updated a Source.
-     * 
-     * @param source the Source to update.
-     */
-    <S extends Source> void updateSource( S source );
-
-    /**
-     * Deletes a Source.
-     * 
-     * @param source the Source to delete.
-     */
-    <S extends Source> void deleteSource( S source );
-
-    /**
-     * Retrieves the Source with the given identifier.
-     * 
-     * @param id the identifier of the Source to retrieve.
-     * @return the Source.
-     */
-    <S extends Source> S getSource( int id );
-
-    /**
-     * Retrieves all Sources of the given Class.
-     * 
-     * @param clazz the Class of the Sources to retrieve.
-     * @return a Collection of Sources.
-     */
-    <S extends Source> Collection<S> getAllSources( Class<S> clazz );
-
-    /**
-     * Retrieves all Sources.
-     * 
-     * @return a Collection of Sources.
-     */
-    <S extends Source> Collection<S> getAllSources();
-}

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationResult.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationResult.java	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationResult.java	2011-04-22 21:04:14 +0000
@@ -29,8 +29,8 @@
 
 import java.io.Serializable;
 
+import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
-import org.hisp.dhis.source.Source;
 
 /**
  * @author Margrethe Store
@@ -39,7 +39,7 @@
 public class ValidationResult
     implements Serializable
 {
-    private Source source;
+    private OrganisationUnit source;
     
     private Period period;
     
@@ -57,7 +57,7 @@
     {      
     }
     
-    public ValidationResult( Period period, Source source, ValidationRule validationRule,
+    public ValidationResult( Period period, OrganisationUnit source, ValidationRule validationRule,
         double leftsideValue, double rightsideValue )
     {
         this.source = source;
@@ -154,12 +154,12 @@
     // Set and get methods
     // -------------------------------------------------------------------------     
 
-    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/validation/ValidationRuleService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleService.java	2011-02-10 23:09:13 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleService.java	2011-04-22 21:04:14 +0000
@@ -34,8 +34,8 @@
 import org.hisp.dhis.common.Grid;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
-import org.hisp.dhis.source.Source;
 
 /**
  * @author Margrethe Store
@@ -55,7 +55,7 @@
      * Returns a Grid containing the percentage of aggregated violations. Periods
      * are listed as columns and Sources are listed as rows.
      */
-    Grid getAggregateValidationResult( Collection<ValidationResult> results, List<Period> periods, List<? extends Source> sources );
+    Grid getAggregateValidationResult( Collection<ValidationResult> results, List<Period> periods, List<OrganisationUnit> sources );
     
     /**
      * Validates AggregatedDataValues.
@@ -65,7 +65,7 @@
      * @param sources a collection of Sources.
      * @return a collection of ValidationResults for each validation violation. 
      */
-    Collection<ValidationResult> validateAggregate( Date startDate, Date endDate, Collection<? extends Source> sources );
+    Collection<ValidationResult> validateAggregate( Date startDate, Date endDate, Collection<OrganisationUnit> sources );
 
     /**
      * Validate AggregatedDataValues.
@@ -76,7 +76,7 @@
      * @param group a group of ValidationRules.
      * @return a collection of ValidationResults for each validation violation. 
      */
-    public Collection<ValidationResult> validateAggregate( Date startDate, Date endDate, Collection<? extends Source> sources, ValidationRuleGroup group );
+    public Collection<ValidationResult> validateAggregate( Date startDate, Date endDate, Collection<OrganisationUnit> sources, ValidationRuleGroup group );
     
     /**
      * Validate DataValues.
@@ -86,7 +86,7 @@
      * @param sources a collection of Sources.
      * @return a collection of ValidationResults for each validation violation. 
      */
-    Collection<ValidationResult> validate( Date startDate, Date endDate, Collection<? extends Source> sources );
+    Collection<ValidationResult> validate( Date startDate, Date endDate, Collection<OrganisationUnit> sources );
     
     /**
      * Validate DataValues.
@@ -97,7 +97,7 @@
      * @param group a group of ValidationRules.
      * @return a collection of ValidationResults for each validation violation. 
      */
-    Collection<ValidationResult> validate( Date startDate, Date endDate, Collection<? extends Source> sources, ValidationRuleGroup group );
+    Collection<ValidationResult> validate( Date startDate, Date endDate, Collection<OrganisationUnit> sources, ValidationRuleGroup group );
     
     /**
      * Validate DataValues.
@@ -107,7 +107,7 @@
      * @param source the Source.
      * @return a collection of ValidationResults for each validation violation. 
      */
-    Collection<ValidationResult> validate( DataSet dataSet, Period period, Source source );
+    Collection<ValidationResult> validate( DataSet dataSet, Period period, OrganisationUnit source );
 
     /**
      * Validate DataValues.
@@ -117,7 +117,7 @@
      * @param source the Source.
      * @return a collection of ValidationResults for each validation violation. 
      */
-    Collection<ValidationResult> validate( Date startDate, Date endDate, Source source );
+    Collection<ValidationResult> validate( Date startDate, Date endDate, OrganisationUnit source );
 
     // -------------------------------------------------------------------------
     // ValidationRule

=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataarchive/ArchivedDataValueDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataarchive/ArchivedDataValueDeletionHandler.java	2010-10-29 12:19:15 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataarchive/ArchivedDataValueDeletionHandler.java	2011-04-22 21:04:14 +0000
@@ -29,8 +29,8 @@
 
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
-import org.hisp.dhis.source.Source;
 import org.hisp.dhis.system.deletion.DeletionHandler;
 import org.springframework.jdbc.core.JdbcTemplate;
 
@@ -77,9 +77,9 @@
     }
     
     @Override
-    public boolean allowDeleteSource( Source source )
+    public boolean allowDeleteOrganisationUnit( OrganisationUnit unit )
     {
-        String sql = "SELECT COUNT(*) FROM datavaluearchive where sourceid=" + source.getId();
+        String sql = "SELECT COUNT(*) FROM datavaluearchive where sourceid=" + unit.getId();
         
         return jdbcTemplate.queryForInt( sql ) == 0;
     }

=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/datalock/hibernate/HibernateDataSetLockStore.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/datalock/hibernate/HibernateDataSetLockStore.java	2010-10-29 12:19:15 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/datalock/hibernate/HibernateDataSetLockStore.java	2011-04-22 21:04:14 +0000
@@ -35,9 +35,9 @@
 import org.hisp.dhis.datalock.DataSetLock;
 import org.hisp.dhis.datalock.DataSetLockStore;
 import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
-import org.hisp.dhis.source.Source;
 
 /**
  * @author Brajesh Murari
@@ -161,7 +161,7 @@
         return (DataSetLock) criteria.uniqueResult();
     }
 
-    public DataSetLock getDataSetLockByDataSetPeriodAndSource( DataSet dataSet, Period period, Source source )
+    public DataSetLock getDataSetLockByDataSetPeriodAndSource( DataSet dataSet, Period period, OrganisationUnit source )
     {
         Session session = sessionFactory.getCurrentSession();
 
@@ -177,7 +177,7 @@
     }
 
     @SuppressWarnings( "unchecked" )
-    public Collection<DataSetLock> getDataSetLocksBySource( Source source )
+    public Collection<DataSetLock> getDataSetLocksBySource( OrganisationUnit source )
     {
         Session session = sessionFactory.getCurrentSession();
 

=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/statistics/jdbc/JdbcStatisticsProvider.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/statistics/jdbc/JdbcStatisticsProvider.java	2010-10-29 12:19:15 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/statistics/jdbc/JdbcStatisticsProvider.java	2011-04-22 21:04:14 +0000
@@ -68,7 +68,7 @@
         objectCounts.put( Objects.INDICATORGROUP, jdbcTemplate.queryForInt( "SELECT COUNT(*) FROM indicatorgroup" ) );
         objectCounts.put( Objects.DATASET, jdbcTemplate.queryForInt( "SELECT COUNT(*) FROM dataset" ) );
         objectCounts.put( Objects.DATADICTIONARY, jdbcTemplate.queryForInt( "SELECT COUNT(*) FROM datadictionary" ) );
-        objectCounts.put( Objects.SOURCE, jdbcTemplate.queryForInt( "SELECT COUNT(*) FROM source" ) );
+        objectCounts.put( Objects.SOURCE, jdbcTemplate.queryForInt( "SELECT COUNT(*) FROM organisationunit" ) );
         objectCounts.put( Objects.VALIDATIONRULE, jdbcTemplate.queryForInt( "SELECT COUNT(*) FROM validationrule" ) );
         objectCounts.put( Objects.PERIOD, jdbcTemplate.queryForInt( "SELECT COUNT(*) FROM period" ) );
         objectCounts.put( Objects.USER, jdbcTemplate.queryForInt( "SELECT COUNT(*) FROM users" ) );

=== modified file 'dhis-2/dhis-services/dhis-service-aggregationengine-default/src/test/java/org/hisp/dhis/aggregation/AggregationStoreTest.java'
--- dhis-2/dhis-services/dhis-service-aggregationengine-default/src/test/java/org/hisp/dhis/aggregation/AggregationStoreTest.java	2011-03-11 08:13:14 +0000
+++ dhis-2/dhis-services/dhis-service-aggregationengine-default/src/test/java/org/hisp/dhis/aggregation/AggregationStoreTest.java	2011-04-22 21:04:14 +0000
@@ -43,10 +43,9 @@
 import org.hisp.dhis.datavalue.DataValue;
 import org.hisp.dhis.datavalue.DataValueService;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
-import org.hisp.dhis.source.Source;
-import org.hisp.dhis.source.SourceStore;
 import org.junit.Test;
 
 /**
@@ -58,8 +57,6 @@
 {
     private AggregationStore aggregationStore;
 
-    private SourceStore sourceStore;
-
     private DataElementCategoryOptionCombo optionCombo;
     
     private StatementManager statementManager;
@@ -76,8 +73,8 @@
         
         periodService = (PeriodService) getBean( PeriodService.ID );
 
-        sourceStore = (SourceStore) getBean( SourceStore.ID );
-
+        organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
+        
         dataValueService = (DataValueService) getBean( DataValueService.ID );
 
         optionCombo = new DataElementCategoryOptionCombo();
@@ -128,9 +125,9 @@
         Period periodG = createPeriod( getDay( 8 ), getDay( 10 ) );
         Period periodH = createPeriod( getDay( 5 ), getDay( 10 ) );
 
-        Source sourceA = new OrganisationUnit( "nameA", null, "shortNameA", "codeA", null, null, false, null );
-        Source sourceB = new OrganisationUnit( "nameB", null, "shortNameB", "codeB", null, null, false, null );
-        Source sourceC = new OrganisationUnit( "nameC", null, "shortNameC", "codeC", null, null, false, null );
+        OrganisationUnit sourceA = new OrganisationUnit( "nameA", null, "shortNameA", "codeA", null, null, false, null );
+        OrganisationUnit sourceB = new OrganisationUnit( "nameB", null, "shortNameB", "codeB", null, null, false, null );
+        OrganisationUnit sourceC = new OrganisationUnit( "nameC", null, "shortNameC", "codeC", null, null, false, null );
 
         DataValue dataValueA = new DataValue( dataElementA, periodA, sourceA, optionCombo );
         dataValueA.setValue( "1" );
@@ -160,9 +157,9 @@
         periodService.addPeriod( periodG );
         periodService.addPeriod( periodH );
 
-        sourceStore.addSource( sourceA );
-        sourceStore.addSource( sourceB );
-        sourceStore.addSource( sourceC );
+        organisationUnitService.addOrganisationUnit( sourceA );
+        organisationUnitService.addOrganisationUnit( sourceB );
+        organisationUnitService.addOrganisationUnit( sourceC );
 
         dataValueService.addDataValue( dataValueA );
         dataValueService.addDataValue( dataValueB );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataanalysis/MinMaxValueMap.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataanalysis/MinMaxValueMap.java	2009-12-23 17:34:18 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataanalysis/MinMaxValueMap.java	2011-04-22 21:04:14 +0000
@@ -32,7 +32,7 @@
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.minmax.MinMaxDataElement;
-import org.hisp.dhis.source.Source;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
 
 /**
  * @author Lars Helge Overland
@@ -49,7 +49,7 @@
         super.put( key, element );
     }
     
-    public MinMaxDataElement get( Source source, DataElement dataElement, DataElementCategoryOptionCombo categoryOptionCombo )
+    public MinMaxDataElement get( OrganisationUnit source, DataElement dataElement, DataElementCategoryOptionCombo categoryOptionCombo )
     {
         return super.get( source.getId() + SEP + dataElement.getId() + SEP + categoryOptionCombo.getId() );
     }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DataSetDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DataSetDeletionHandler.java	2010-08-18 08:04:37 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DataSetDeletionHandler.java	2011-04-22 21:04:14 +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,11 +72,11 @@
     }
 
     @Override
-    public void deleteSource( Source source )
+    public void deleteOrganisationUnit( OrganisationUnit unit )
     {
         for ( DataSet dataSet : dataSetService.getAllDataSets() )
         {
-            if ( dataSet.getSources().remove( source ) )
+            if ( dataSet.getSources().remove( unit ) )
             {
                 dataSetService.updateDataSet( dataSet );
             }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DataValueAuditDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DataValueAuditDeletionHandler.java	2010-06-14 15:51:12 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DataValueAuditDeletionHandler.java	2011-04-22 21:04:14 +0000
@@ -29,8 +29,8 @@
 
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
-import org.hisp.dhis.source.Source;
 import org.hisp.dhis.system.deletion.DeletionHandler;
 
 /**
@@ -63,9 +63,9 @@
     }
 
     @Override
-    public void deleteSource( Source source )
+    public void deleteOrganisationUnit( OrganisationUnit unit )
     {
-    	dataValueAuditService.deleteDataValueAuditBySource( source );
+    	dataValueAuditService.deleteDataValueAuditBySource( unit );
     }
 
     @Override

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DataValueDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DataValueDeletionHandler.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DataValueDeletionHandler.java	2011-04-22 21:04:14 +0000
@@ -29,8 +29,8 @@
 
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
-import org.hisp.dhis.source.Source;
 import org.hisp.dhis.system.deletion.DeletionHandler;
 import org.springframework.jdbc.core.JdbcTemplate;
 
@@ -79,9 +79,9 @@
     }
     
     @Override
-    public boolean allowDeleteSource( Source source )
+    public boolean allowDeleteOrganisationUnit( OrganisationUnit unit )
     {
-        String sql = "SELECT COUNT(*) FROM datavalue where sourceid=" + source.getId();
+        String sql = "SELECT COUNT(*) FROM datavalue where sourceid=" + unit.getId();
         
         return jdbcTemplate.queryForInt( sql ) == 0;
     }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueAuditService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueAuditService.java	2010-06-09 10:37:45 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueAuditService.java	2011-04-22 21:04:14 +0000
@@ -31,8 +31,8 @@
 
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
-import org.hisp.dhis.source.Source;
 
 /**
  * @author Quang Nguyen
@@ -81,9 +81,9 @@
         return dataValueAuditStore.getAll();
     }
 
-    public void deleteDataValueAuditBySource( Source source )
+    public void deleteDataValueAuditBySource( OrganisationUnit unit )
     {
-        dataValueAuditStore.deleteDataValueAuditBySource( source );
+        dataValueAuditStore.deleteDataValueAuditBySource( unit );
     }
 
     public void deleteDataValueAuditByDataElement( DataElement dataElement )

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueService.java	2011-04-14 09:05:18 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueService.java	2011-04-22 21:04:14 +0000
@@ -39,7 +39,6 @@
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodType;
-import org.hisp.dhis.source.Source;
 import org.springframework.transaction.annotation.Transactional;
 
 /**
@@ -95,7 +94,7 @@
     }
 
     @Transactional
-    public int deleteDataValuesBySource( Source source )
+    public int deleteDataValuesBySource( OrganisationUnit source )
     {
         return dataValueStore.deleteDataValuesBySource( source );
     }
@@ -106,7 +105,7 @@
         return dataValueStore.deleteDataValuesByDataElement( dataElement );
     }
 
-    public DataValue getDataValue( Source source, DataElement dataElement, Period period,
+    public DataValue getDataValue( OrganisationUnit source, DataElement dataElement, Period period,
         DataElementCategoryOptionCombo optionCombo )
     {
         return dataValueStore.getDataValue( source, dataElement, period, optionCombo );
@@ -126,46 +125,46 @@
         return dataValueStore.getAllDataValues();
     }
 
-    public Collection<DataValue> getDataValues( Source source, Period period )
+    public Collection<DataValue> getDataValues( OrganisationUnit source, Period period )
     {
         return dataValueStore.getDataValues( source, period );
     }
 
-    public Collection<DataValue> getDataValues( Source source, DataElement dataElement )
+    public Collection<DataValue> getDataValues( OrganisationUnit source, DataElement dataElement )
     {
         return dataValueStore.getDataValues( source, dataElement );
     }
 
-    public Collection<DataValue> getDataValues( Collection<Source> sources, DataElement dataElement )
+    public Collection<DataValue> getDataValues( Collection<OrganisationUnit> sources, DataElement dataElement )
     {
         return dataValueStore.getDataValues( sources, dataElement );
     }
 
-    public Collection<DataValue> getDataValues( Source source, Period period, Collection<DataElement> dataElements )
+    public Collection<DataValue> getDataValues( OrganisationUnit source, Period period, Collection<DataElement> dataElements )
     {
         return dataValueStore.getDataValues( source, period, dataElements );
     }
 
-    public Collection<DataValue> getDataValues( Source source, Period period, Collection<DataElement> dataElements,
+    public Collection<DataValue> getDataValues( OrganisationUnit source, Period period, Collection<DataElement> dataElements,
         Collection<DataElementCategoryOptionCombo> optionCombos )
     {
         return dataValueStore.getDataValues( source, period, dataElements, optionCombos );
     }
 
     public Collection<DataValue> getDataValues( DataElement dataElement, Period period,
-        Collection<? extends Source> sources )
+        Collection<OrganisationUnit> sources )
     {
         return dataValueStore.getDataValues( dataElement, period, sources );
     }
 
     public Collection<DataValue> getDataValues( DataElement dataElement, Collection<Period> periods,
-        Collection<? extends Source> sources )
+        Collection<OrganisationUnit> sources )
     {
         return dataValueStore.getDataValues( dataElement, periods, sources );
     }
 
     public Collection<DataValue> getDataValues( DataElement dataElement, DataElementCategoryOptionCombo optionCombo,
-        Collection<Period> periods, Collection<? extends Source> sources )
+        Collection<Period> periods, Collection<OrganisationUnit> sources )
     {
         return dataValueStore.getDataValues( dataElement, optionCombo, periods, sources );
     }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueAuditStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueAuditStore.java	2010-10-29 12:19:15 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueAuditStore.java	2011-04-22 21:04:14 +0000
@@ -39,8 +39,8 @@
 import org.hisp.dhis.datavalue.DataValue;
 import org.hisp.dhis.datavalue.DataValueAudit;
 import org.hisp.dhis.datavalue.DataValueAuditStore;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
-import org.hisp.dhis.source.Source;
 
 /**
  * @author Quang Nguyen
@@ -89,7 +89,7 @@
         return query.executeUpdate();
     }
 
-    public void deleteDataValueAuditBySource( Source source )
+    public void deleteDataValueAuditBySource( OrganisationUnit source )
     {
         for ( DataValueAudit each : getAll() )
         {

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueStore.java	2011-04-14 09:05:18 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueStore.java	2011-04-22 21:04:14 +0000
@@ -48,7 +48,6 @@
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodStore;
 import org.hisp.dhis.period.PeriodType;
-import org.hisp.dhis.source.Source;
 
 /**
  * @author Torgeir Lorange Ostby
@@ -112,7 +111,7 @@
         session.delete( dataValue );
     }
 
-    public int deleteDataValuesBySource( Source source )
+    public int deleteDataValuesBySource( OrganisationUnit source )
     {
         Session session = sessionFactory.getCurrentSession();
 
@@ -132,7 +131,7 @@
         return query.executeUpdate();
     }
 
-    public DataValue getDataValue( Source source, DataElement dataElement, Period period,
+    public DataValue getDataValue( OrganisationUnit source, DataElement dataElement, Period period,
         DataElementCategoryOptionCombo optionCombo )
     {
         Session session = sessionFactory.getCurrentSession();
@@ -177,7 +176,7 @@
     }
 
     @SuppressWarnings( "unchecked" )
-    public Collection<DataValue> getDataValues( Source source, Period period )
+    public Collection<DataValue> getDataValues( OrganisationUnit source, Period period )
     {
         Period storedPeriod = periodStore.reloadPeriod( period );
 
@@ -196,7 +195,7 @@
     }
 
     @SuppressWarnings( "unchecked" )
-    public Collection<DataValue> getDataValues( Source source, DataElement dataElement )
+    public Collection<DataValue> getDataValues( OrganisationUnit source, DataElement dataElement )
     {
         Session session = sessionFactory.getCurrentSession();
 
@@ -208,7 +207,7 @@
     }
 
     @SuppressWarnings( "unchecked" )
-    public Collection<DataValue> getDataValues( Collection<? extends Source> sources, DataElement dataElement )
+    public Collection<DataValue> getDataValues( Collection<OrganisationUnit> sources, DataElement dataElement )
     {
         Session session = sessionFactory.getCurrentSession();
 
@@ -220,7 +219,7 @@
     }
 
     @SuppressWarnings( "unchecked" )
-    public Collection<DataValue> getDataValues( Source source, Period period, Collection<DataElement> dataElements )
+    public Collection<DataValue> getDataValues( OrganisationUnit source, Period period, Collection<DataElement> dataElements )
     {
         Period storedPeriod = periodStore.reloadPeriod( period );
 
@@ -240,7 +239,7 @@
     }
 
     @SuppressWarnings( "unchecked" )
-    public Collection<DataValue> getDataValues( Source source, Period period, Collection<DataElement> dataElements,
+    public Collection<DataValue> getDataValues( OrganisationUnit source, Period period, Collection<DataElement> dataElements,
         Collection<DataElementCategoryOptionCombo> optionCombos )
     {
         Period storedPeriod = periodStore.reloadPeriod( period );
@@ -263,7 +262,7 @@
 
     @SuppressWarnings( "unchecked" )
     public Collection<DataValue> getDataValues( DataElement dataElement, Period period,
-        Collection<? extends Source> sources )
+        Collection<OrganisationUnit> sources )
     {
         Period storedPeriod = periodStore.reloadPeriod( period );
 
@@ -284,7 +283,7 @@
 
     @SuppressWarnings( "unchecked" )
     public Collection<DataValue> getDataValues( DataElement dataElement, Collection<Period> periods,
-        Collection<? extends Source> sources )
+        Collection<OrganisationUnit> sources )
     {
         Collection<Period> storedPeriods = new ArrayList<Period>();
 
@@ -310,7 +309,7 @@
 
     @SuppressWarnings( "unchecked" )
     public Collection<DataValue> getDataValues( DataElement dataElement, DataElementCategoryOptionCombo optionCombo,
-        Collection<Period> periods, Collection<? extends Source> sources )
+        Collection<Period> periods, Collection<OrganisationUnit> sources )
     {
         Collection<Period> storedPeriods = new ArrayList<Period>();
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java	2011-01-27 17:41:50 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java	2011-04-22 21:04:14 +0000
@@ -27,7 +27,9 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.hisp.dhis.expression.Expression.*;
+import static org.hisp.dhis.expression.Expression.EXP_CLOSE;
+import static org.hisp.dhis.expression.Expression.EXP_OPEN;
+import static org.hisp.dhis.expression.Expression.SEPARATOR;
 import static org.hisp.dhis.system.util.MathUtils.calculateExpression;
 
 import java.util.Collection;
@@ -50,8 +52,8 @@
 import org.hisp.dhis.dataelement.DataElementOperand;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.datavalue.DataValueService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
-import org.hisp.dhis.source.Source;
 import org.hisp.dhis.system.util.MathUtils;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -145,7 +147,7 @@
     // Business logic
     // -------------------------------------------------------------------------
 
-    public Double getExpressionValue( Expression expression, Period period, Source source, boolean nullIfNoValues, boolean aggregate )
+    public Double getExpressionValue( Expression expression, Period period, OrganisationUnit source, boolean nullIfNoValues, boolean aggregate )
     {
         final String expressionString = generateExpression( expression.getExpression(), period, source, nullIfNoValues, aggregate );
 
@@ -417,7 +419,7 @@
         return buffer != null ? buffer.toString() : null;
     }
     
-    public String generateExpression( String expression, Period period, Source source, boolean nullIfNoValues, boolean aggregated )
+    public String generateExpression( String expression, Period period, OrganisationUnit source, boolean nullIfNoValues, boolean aggregated )
     {
         StringBuffer buffer = null;
         

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java	2011-04-22 17:45:58 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java	2011-04-22 21:04:14 +0000
@@ -43,8 +43,6 @@
 import org.hisp.dhis.hierarchy.HierarchyViolationException;
 import org.hisp.dhis.organisationunit.comparator.OrganisationUnitLevelComparator;
 import org.hisp.dhis.organisationunit.comparator.OrganisationUnitNameComparator;
-import org.hisp.dhis.source.Source;
-import org.hisp.dhis.source.SourceStore;
 import org.hisp.dhis.system.util.AuditLogUtil;
 import org.hisp.dhis.system.util.Filter;
 import org.hisp.dhis.system.util.FilterUtils;
@@ -69,13 +67,6 @@
     // Dependencies
     // -------------------------------------------------------------------------
 
-    private SourceStore sourceStore;
-
-    public void setSourceStore( SourceStore sourceStore )
-    {
-        this.sourceStore = sourceStore;
-    }
-
     private OrganisationUnitStore organisationUnitStore;
 
     public void setOrganisationUnitStore( OrganisationUnitStore organisationUnitStore )
@@ -103,7 +94,7 @@
 
         organisationUnit.setLastUpdated( new Date() );
 
-        int id = sourceStore.addSource( organisationUnit );
+        int id = organisationUnitStore.save( organisationUnit );
 
         log.info( AuditLogUtil.logMessage( currentUserService.getCurrentUsername(),
             AuditLogUtil.ACTION_ADD, OrganisationUnit.class.getSimpleName(), organisationUnit.getName() ) );
@@ -115,7 +106,7 @@
     {
         organisationUnit.setLastUpdated( new Date() );
 
-        sourceStore.updateSource( organisationUnit );
+        organisationUnitStore.update( organisationUnit );
 
         log.info( AuditLogUtil.logMessage( currentUserService.getCurrentUsername(),
             AuditLogUtil.ACTION_EDIT, OrganisationUnit.class.getSimpleName(), organisationUnit.getName() ) );
@@ -140,10 +131,10 @@
         {
             parent.getChildren().remove( organisationUnit );
 
-            sourceStore.updateSource( parent );
+            organisationUnitStore.update( parent );
         }
 
-        sourceStore.deleteSource( organisationUnit );
+        organisationUnitStore.delete( organisationUnit );
 
         log.info( AuditLogUtil.logMessage( currentUserService.getCurrentUsername(),
             AuditLogUtil.ACTION_DELETE, OrganisationUnit.class.getSimpleName(), organisationUnit.getName() ) );
@@ -151,12 +142,12 @@
 
     public OrganisationUnit getOrganisationUnit( int id )
     {
-        return sourceStore.getSource( id );
+        return organisationUnitStore.get( id );
     }
 
     public Collection<OrganisationUnit> getAllOrganisationUnits()
     {
-        return sourceStore.getAllSources();
+        return organisationUnitStore.getAll();
     }
 
     public Collection<OrganisationUnit> getOrganisationUnits( final Collection<Integer> identifiers )
@@ -174,12 +165,12 @@
 
     public OrganisationUnit getOrganisationUnit( String uuid )
     {
-        return organisationUnitStore.getOrganisationUnit( uuid );
+        return organisationUnitStore.getByUuid( uuid );
     }
 
     public OrganisationUnit getOrganisationUnitByName( String name )
     {
-        return organisationUnitStore.getOrganisationUnitByName( name );
+        return organisationUnitStore.getByName( name );
     }
     
     public OrganisationUnit getOrganisationUnitByNameIgnoreCase( String name )
@@ -573,16 +564,6 @@
     }
 
     @Override
-    public Set<Source> convert( Collection<OrganisationUnit> organisationUnits )
-    {
-        Set<Source> sources = new HashSet<Source>();
-
-        sources.addAll( organisationUnits );
-
-        return sources;
-    }
-
-    @Override
     public int getMaxOfOrganisationUnitLevels()
     {
         return organisationUnitStore.getMaxOfOrganisationUnitLevels();

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupDeletionHandler.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupDeletionHandler.java	2011-04-22 21:04:14 +0000
@@ -27,7 +27,6 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import org.hisp.dhis.source.Source;
 import org.hisp.dhis.system.deletion.DeletionHandler;
 
 /**
@@ -59,11 +58,11 @@
     }
     
     @Override
-    public void deleteSource( Source source )
+    public void deleteOrganisationUnit( OrganisationUnit unit )
     {
         for ( OrganisationUnitGroup group : organisationUnitGroupService.getAllOrganisationUnitGroups() )
         {
-            if ( group.getMembers().remove( source ) )
+            if ( group.getMembers().remove( unit ) )
             {
                 organisationUnitGroupService.updateOrganisationUnitGroup( group );
             }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitStore.java	2011-04-11 16:43:51 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitStore.java	2011-04-22 21:04:14 +0000
@@ -36,8 +36,8 @@
 import org.hibernate.Criteria;
 import org.hibernate.Query;
 import org.hibernate.Session;
-import org.hibernate.SessionFactory;
 import org.hibernate.criterion.Restrictions;
+import org.hisp.dhis.hibernate.HibernateGenericStore;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
 import org.hisp.dhis.organisationunit.OrganisationUnitHierarchy;
@@ -52,19 +52,12 @@
  * @version $Id: HibernateOrganisationUnitStore.java 6251 2008-11-10 14:37:05Z larshelg $
  */
 public class HibernateOrganisationUnitStore
-    implements OrganisationUnitStore
+    extends HibernateGenericStore<OrganisationUnit> implements OrganisationUnitStore
 {
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
 
-    private SessionFactory sessionFactory;
-
-    public void setSessionFactory( SessionFactory sessionFactory )
-    {
-        this.sessionFactory = sessionFactory;
-    }
-
     private StatementManager statementManager;
 
     public void setStatementManager( StatementManager statementManager )
@@ -92,17 +85,6 @@
         
         return (OrganisationUnit) criteria.uniqueResult();                
     }
-
-    public OrganisationUnit getOrganisationUnitByName( String name )
-    {
-        Session session = sessionFactory.getCurrentSession();
-
-        Query query = session.createQuery( "from OrganisationUnit o where o.name = :name" );
-
-        query.setString( "name", name );
-
-        return (OrganisationUnit) query.uniqueResult();
-    }
     
     public OrganisationUnit getOrganisationUnitByNameIgnoreCase( String name )
     {

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/period/DefaultPeriodService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/period/DefaultPeriodService.java	2010-12-02 22:05:55 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/period/DefaultPeriodService.java	2011-04-22 21:04:14 +0000
@@ -38,7 +38,7 @@
 
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.i18n.I18nFormat;
-import org.hisp.dhis.source.Source;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.system.util.DateUtils;
 import org.hisp.dhis.system.util.Filter;
 import org.hisp.dhis.system.util.FilterUtils;
@@ -205,7 +205,7 @@
     }
 
     public Collection<Period> getPeriods( Period period, Collection<DataElement> dataElements,
-        Collection<? extends Source> sources )
+        Collection<OrganisationUnit> sources )
     {
         return periodStore.getPeriods( period, dataElements, sources );
     }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/period/hibernate/HibernatePeriodStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/period/hibernate/HibernatePeriodStore.java	2011-04-03 10:25:42 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/period/hibernate/HibernatePeriodStore.java	2011-04-22 21:04:14 +0000
@@ -38,10 +38,10 @@
 import org.hibernate.criterion.Restrictions;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.datavalue.DataValue;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodStore;
 import org.hisp.dhis.period.PeriodType;
-import org.hisp.dhis.source.Source;
 
 /**
  * Implements the PeriodStore interface.
@@ -187,7 +187,7 @@
 
     @SuppressWarnings( "unchecked" )
     public Collection<Period> getPeriods( Period period, Collection<DataElement> dataElements,
-        Collection<? extends Source> sources )
+        Collection<OrganisationUnit> sources )
     {
         Set<Period> periods = new HashSet<Period>();
 

=== removed directory 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/source'
=== removed directory 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/source/hibernate'
=== removed file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/source/hibernate/HibernateSourceStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/source/hibernate/HibernateSourceStore.java	2010-10-29 12:19:15 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/source/hibernate/HibernateSourceStore.java	1970-01-01 00:00:00 +0000
@@ -1,103 +0,0 @@
-package org.hisp.dhis.source.hibernate;
-
-/*
- * Copyright (c) 2004-2010, 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.Session;
-import org.hibernate.SessionFactory;
-import org.hisp.dhis.source.Source;
-import org.hisp.dhis.source.SourceStore;
-
-/**
- * @author Torgeir Lorange Ostby
- * @version $Id: HibernateSourceStore.java 2919 2007-02-26 18:56:19Z margrsto $
- */
-public class HibernateSourceStore
-    implements SourceStore
-{
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private SessionFactory sessionFactory;
-
-    public void setSessionFactory( SessionFactory sessionFactory )
-    {
-        this.sessionFactory = sessionFactory;
-    }
-
-    // -------------------------------------------------------------------------
-    // SourceStore implementation
-    // -------------------------------------------------------------------------
-
-    public <S extends Source> int addSource( S source )
-    {
-        Session session = sessionFactory.getCurrentSession();
-
-        return (Integer) session.save( source );
-    }
-
-    public <S extends Source> void updateSource( S source )
-    {
-        Session session = sessionFactory.getCurrentSession();
-
-        session.update( source );
-    }
-
-    public <S extends Source> void deleteSource( S source )
-    {
-        Session session = sessionFactory.getCurrentSession();
-
-        session.delete( source );
-    }
-
-    @SuppressWarnings( "unchecked" )
-    public <S extends Source> S getSource( int id )
-    {
-        Session session = sessionFactory.getCurrentSession();
-
-        return (S) session.get( Source.class, id );
-    }
-
-    @SuppressWarnings( "unchecked" )
-    public <S extends Source> Collection<S> getAllSources( Class<S> clazz )
-    {
-        Session session = sessionFactory.getCurrentSession();
-
-        return session.createCriteria( clazz ).list();
-    }
-
-    @SuppressWarnings( "unchecked" )
-    public <S extends Source> Collection<S> getAllSources()
-    {
-        Session session = sessionFactory.getCurrentSession();
-
-        return session.createCriteria( Source.class ).list();
-    }
-}

=== 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:56:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2011-04-22 21:04:14 +0000
@@ -272,6 +272,10 @@
         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" );
+        executeSql( "ALTER TABLE datavalue DROP CONSTRAINT fk_datavalue_sourceid" );
+        executeSql( "ALTER TABLE datavaluearchive DROP CONSTRAINT fk_datavaluearchive_sourceid" );
+        executeSql( "ALTER TABLE organisationunit DROP CONSTRAINT fke509dd5ef1c932ed" );
+        executeSql( "DROP TABLE source CASCADE" );        
         
         log.info( "Tables updated" );
     }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableCreator.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableCreator.java	2011-03-01 17:14:27 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableCreator.java	2011-04-22 21:04:14 +0000
@@ -152,7 +152,7 @@
                 "CONSTRAINT fk_datavaluearchive_periodid FOREIGN KEY (periodid) " +
                     "REFERENCES period (periodid), " +
                 "CONSTRAINT fk_datavaluearchive_sourceid FOREIGN KEY (sourceid) " +
-                    "REFERENCES source (sourceid) );";
+                    "REFERENCES organisationunit (organisationunitid) );";
             
             jdbcTemplate.execute( sql );
             

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserDeletionHandler.java	2010-06-09 10:37:45 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/UserDeletionHandler.java	2011-04-22 21:04:14 +0000
@@ -29,7 +29,7 @@
 
 import java.util.Collection;
 
-import org.hisp.dhis.source.Source;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.system.deletion.DeletionHandler;
 
 /**
@@ -61,7 +61,7 @@
     }
     
     @Override
-    public void deleteSource( Source unit )
+    public void deleteOrganisationUnit( OrganisationUnit unit )
     {
         for ( User user : userStore.getAllUsers() )
         {

=== 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	2011-04-22 17:02:27 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java	2011-04-22 21:04:14 +0000
@@ -46,7 +46,6 @@
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
-import org.hisp.dhis.source.Source;
 import org.hisp.dhis.system.grid.ListGrid;
 import org.hisp.dhis.system.util.CompositeCounter;
 import org.hisp.dhis.system.util.Filter;
@@ -114,7 +113,7 @@
     // ValidationRule business logic
     // -------------------------------------------------------------------------
 
-    public Grid getAggregateValidationResult( Collection<ValidationResult> results, List<Period> periods, List<? extends Source> sources )
+    public Grid getAggregateValidationResult( Collection<ValidationResult> results, List<Period> periods, List<OrganisationUnit> sources )
     {
         int number = validationRuleStore.getNumberOfValidationRules();
         
@@ -135,7 +134,7 @@
             grid.addValue( period.getName() );
         }
         
-        for ( Source source : sources )
+        for ( OrganisationUnit source : sources )
         {
             grid.addRow();
             grid.addValue( source.getName() );
@@ -151,7 +150,7 @@
         return grid;
     }
     
-    public Collection<ValidationResult> validateAggregate( Date startDate, Date endDate, Collection<? extends Source> sources )
+    public Collection<ValidationResult> validateAggregate( Date startDate, Date endDate, Collection<OrganisationUnit> sources )
     {
         Collection<Period> periods = periodService.getPeriodsBetweenDates( startDate, endDate );
         
@@ -159,7 +158,7 @@
 
         Collection<ValidationResult> validationViolations = new HashSet<ValidationResult>();
 
-        for ( Source source : sources  )
+        for ( OrganisationUnit source : sources  )
         {
             for ( Period period : periods )
             {
@@ -170,18 +169,11 @@
         return validationViolations;
     }
 
-    public Collection<ValidationResult> validateAggregate( Date startDate, Date endDate, Collection<? extends Source> sources, ValidationRuleGroup group )
+    public Collection<ValidationResult> validateAggregate( Date startDate, Date endDate, Collection<OrganisationUnit> sources, ValidationRuleGroup group )
     {
         Collection<Period> periods = periodService.getPeriodsBetweenDates( startDate, endDate );
         
-        Collection<OrganisationUnit> units = new HashSet<OrganisationUnit>(); //TODO fix
-        
-        for ( Source source : sources )
-        {
-            units.add( (OrganisationUnit) source );
-        }
-        
-        Collection<DataSet> dataSets = dataSetService.getDataSetsBySources( units );
+        Collection<DataSet> dataSets = dataSetService.getDataSetsBySources( sources );
         
         Collection<DataElement> dataElements = dataElementService.getDataElementsByDataSets( dataSets );
         
@@ -191,7 +183,7 @@
         
         Collection<ValidationResult> validationViolations = new HashSet<ValidationResult>();
 
-        for ( Source source : sources  )
+        for ( OrganisationUnit source : sources  )
         {
             for ( Period period : periods )
             {
@@ -202,13 +194,13 @@
         return validationViolations;
     }
     
-    public Collection<ValidationResult> validate( Date startDate, Date endDate, Collection<? extends Source> sources )
+    public Collection<ValidationResult> validate( Date startDate, Date endDate, Collection<OrganisationUnit> sources )
     {
         Collection<ValidationResult> validationViolations = new HashSet<ValidationResult>();
 
         Collection<Period> relevantPeriods = periodService.getPeriodsBetweenDates( startDate, endDate );
 
-        for ( Source source : sources )
+        for ( OrganisationUnit source : sources )
         {
             Collection<ValidationRule> relevantRules = getRelevantValidationRules( source.getDataElementsInDataSets() );
                 
@@ -224,14 +216,14 @@
         return validationViolations;
     }
 
-    public Collection<ValidationResult> validate( Date startDate, Date endDate, Collection<? extends Source> sources,
+    public Collection<ValidationResult> validate( Date startDate, Date endDate, Collection<OrganisationUnit> sources,
         ValidationRuleGroup group )
     {
         Collection<ValidationResult> validationViolations = new HashSet<ValidationResult>();
 
         Collection<Period> relevantPeriods = periodService.getPeriodsBetweenDates( startDate, endDate );
 
-        for ( Source source : sources )
+        for ( OrganisationUnit source : sources )
         {
             Collection<ValidationRule> relevantRules = getRelevantValidationRules( source.getDataElementsInDataSets() );
             relevantRules.retainAll( group.getMembers() );
@@ -248,7 +240,7 @@
         return validationViolations;
     }
 
-    public Collection<ValidationResult> validate( Date startDate, Date endDate, Source source )
+    public Collection<ValidationResult> validate( Date startDate, Date endDate, OrganisationUnit source )
     {
         Collection<ValidationResult> validationViolations = new HashSet<ValidationResult>();
 
@@ -264,7 +256,7 @@
         return validationViolations;
     }
 
-    public Collection<ValidationResult> validate( DataSet dataSet, Period period, Source source )
+    public Collection<ValidationResult> validate( DataSet dataSet, Period period, OrganisationUnit source )
     {
         return validateInternal( period, source, getRelevantValidationRules( dataSet.getDataElements() ), false, 0 );
     }
@@ -294,7 +286,7 @@
      * @param validationRules the rules to validate.
      * @returns a collection of rules that did not pass validation.
      */
-    private Collection<ValidationResult> validateInternal( final Period period, final Source source,
+    private Collection<ValidationResult> validateInternal( final Period period, final OrganisationUnit source,
         final Collection<ValidationRule> validationRules, boolean aggregate, int currentSize )
     {
         final Collection<ValidationResult> validationViolations = new HashSet<ValidationResult>();

=== 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	2011-04-21 17:09:10 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2011-04-22 21:04:14 +0000
@@ -76,10 +76,6 @@
 		<property name="sessionFactory" ref="sessionFactory"/>
 	</bean>
 
-	<bean id="org.hisp.dhis.source.SourceStore" class="org.hisp.dhis.source.hibernate.HibernateSourceStore">
-		<property name="sessionFactory" ref="sessionFactory"/>
-	</bean>
-
 	<bean id="org.hisp.dhis.dataset.DataSetStore" class="org.hisp.dhis.dataset.hibernate.HibernateDataSetStore">
 		<property name="clazz" value="org.hisp.dhis.dataset.DataSet" />
 		<property name="sessionFactory" ref="sessionFactory"/>
@@ -149,6 +145,7 @@
 
 	<bean id="org.hisp.dhis.organisationunit.OrganisationUnitStore"
 		class="org.hisp.dhis.organisationunit.hibernate.HibernateOrganisationUnitStore">
+		<property name="clazz" value="org.hisp.dhis.organisationunit.OrganisationUnit"/>
 		<property name="sessionFactory" ref="sessionFactory"/>
 		<property name="statementManager" ref="statementManager"/>
 		<property name="jdbcTemplate" ref="jdbcTemplate"/>
@@ -329,7 +326,6 @@
 
 	<bean id="org.hisp.dhis.organisationunit.OrganisationUnitService"
 		class="org.hisp.dhis.organisationunit.DefaultOrganisationUnitService">
-		<property name="sourceStore" ref="org.hisp.dhis.source.SourceStore" />
 		<property name="organisationUnitStore"
 			ref="org.hisp.dhis.organisationunit.OrganisationUnitStore" />
 		<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/datavalue/hibernate/DataValue.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/datavalue/hibernate/DataValue.hbm.xml	2011-04-12 13:25:06 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/datavalue/hibernate/DataValue.hbm.xml	2011-04-22 21:04:14 +0000
@@ -6,15 +6,10 @@
   <class name="org.hisp.dhis.datavalue.DataValue" table="datavalue">
 
     <composite-id>
-      <key-many-to-one name="dataElement" class="org.hisp.dhis.dataelement.DataElement" column="dataelementid"
-        foreign-key="fk_datavalue_dataelementid" />
-      <key-many-to-one name="period" class="org.hisp.dhis.period.Period" column="periodid" foreign-key="fk_datavalue_periodid" />
-      <!-- The source relationship is made not lazy so that Hibernate won't put a proxy on the reference which cannot be 
-        casted to the desired subclass. -->
-      <key-many-to-one name="source" class="org.hisp.dhis.source.Source" lazy="false" column="sourceid"
-        foreign-key="fk_datavalue_sourceid" />
-      <key-many-to-one name="optionCombo" class="org.hisp.dhis.dataelement.DataElementCategoryOptionCombo"
-        column="categoryoptioncomboid" foreign-key="fk_datavalue_categoryoptioncomboid" />
+      <key-many-to-one name="dataElement" class="org.hisp.dhis.dataelement.DataElement" column="dataelementid" foreign-key="fk_datavalue_dataelementid" />
+      <key-many-to-one name="period" class="org.hisp.dhis.period.Period" column="periodid" foreign-key="fk_datavalue_periodid" />      
+      <key-many-to-one name="source" class="org.hisp.dhis.organisationunit.OrganisationUnit" lazy="false" column="sourceid" foreign-key="fk_datavalue_organisationunitid" />
+      <key-many-to-one name="optionCombo" class="org.hisp.dhis.dataelement.DataElementCategoryOptionCombo" column="categoryoptioncomboid" foreign-key="fk_datavalue_categoryoptioncomboid" />
     </composite-id>
 
     <property name="value" />

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnit.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnit.hbm.xml	2011-04-12 13:25:06 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/organisationunit/hibernate/OrganisationUnit.hbm.xml	2011-04-22 21:04:14 +0000
@@ -3,10 +3,13 @@
   "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd";>
 
 <hibernate-mapping>
-  <joined-subclass name="org.hisp.dhis.organisationunit.OrganisationUnit" extends="org.hisp.dhis.source.Source"
-    table="organisationunit">
-
-    <key column="organisationunitid" />
+  <class name="org.hisp.dhis.organisationunit.OrganisationUnit" table="organisationunit">
+
+    <cache usage="read-write" />
+
+    <id name="id" column="organisationunitid">
+      <generator class="native" />
+    </id>
 
     <property name="uuid">
       <column name="uuid" length="40" />
@@ -50,6 +53,11 @@
 
     <property name="lastUpdated" />
 
+    <set name="dataSets" table="datasetsource" inverse="true">
+      <key column="sourceid" />
+      <many-to-many class="org.hisp.dhis.dataset.DataSet" column="datasetid" />
+    </set>
+
     <set name="groups" table="orgunitgroupmembers" inverse="true">
       <key column="organisationunitid" />
       <many-to-many class="org.hisp.dhis.organisationunit.OrganisationUnitGroup" column="orgunitgroupid" />
@@ -74,5 +82,5 @@
 
     <property name="hasPatients" />
 
-  </joined-subclass>
+  </class>
 </hibernate-mapping>

=== removed directory 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/source'
=== removed directory 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/source/hibernate'
=== removed file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/source/hibernate/Source.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/source/hibernate/Source.hbm.xml	2011-04-22 18:38:43 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/source/hibernate/Source.hbm.xml	1970-01-01 00:00:00 +0000
@@ -1,19 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC
-  "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
-  "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd";>
-
-<hibernate-mapping>
-  <class name="org.hisp.dhis.source.Source" table="source" abstract="true">
-
-    <id name="id" column="sourceid">
-      <generator class="native" />
-    </id>
-
-    <set name="dataSets" table="datasetsource" inverse="true">
-      <key column="sourceid" />
-      <many-to-many class="org.hisp.dhis.dataset.DataSet" column="datasetid" />
-    </set>
-
-  </class>
-</hibernate-mapping>

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueDimensionTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueDimensionTest.java	2010-11-09 21:57:28 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueDimensionTest.java	2011-04-22 21:04:14 +0000
@@ -44,11 +44,10 @@
 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.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
-import org.hisp.dhis.source.Source;
-import org.hisp.dhis.source.SourceStore;
 import org.junit.Test;
 
 /**
@@ -72,7 +71,7 @@
     
     private Period periodA;
     
-    private Source sourceA;
+    private OrganisationUnit sourceA;
         
     @Override
     public void setUpTest()
@@ -81,7 +80,7 @@
         dataElementService = (DataElementService) getBean( DataElementService.ID );
         dataValueService = (DataValueService) getBean( DataValueService.ID );
         periodService = (PeriodService) getBean( PeriodService.ID );
-        sourceStore = (SourceStore) getBean( SourceStore.ID );
+        organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
         
         male = new DataElementCategoryOption( "Male" );
         female = new DataElementCategoryOption( "Female" );
@@ -120,9 +119,9 @@
         
         periodService.addPeriod( periodA );
         
-        sourceA = new MockSource( "Bobs Clinic" );
+        sourceA = createOrganisationUnit( 'A' );
         
-        sourceStore.addSource( sourceA );
+        organisationUnitService.addOrganisationUnit( sourceA );
         
         for ( DataElementCategoryOptionCombo categoryOptionCombo : genderAndAgeGroup.getOptionCombos() )
         {

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueServiceTest.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueServiceTest.java	2011-04-22 21:04:14 +0000
@@ -41,11 +41,10 @@
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.hisp.dhis.dataelement.DataElementStore;
-import org.hisp.dhis.mock.MockSource;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
-import org.hisp.dhis.source.Source;
-import org.hisp.dhis.source.SourceStore;
 import org.junit.Test;
 
 /**
@@ -57,8 +56,6 @@
 {
     private DataElementStore dataElementStore;
 
-    private SourceStore sourceStore;
-    
     // -------------------------------------------------------------------------
     // Supporting data
     // -------------------------------------------------------------------------
@@ -81,13 +78,13 @@
 
     private Period periodD;
 
-    private Source sourceA;
-
-    private Source sourceB;
-
-    private Source sourceC;
-
-    private Source sourceD;
+    private OrganisationUnit sourceA;
+
+    private OrganisationUnit sourceB;
+
+    private OrganisationUnit sourceC;
+
+    private OrganisationUnit sourceD;
 
     // -------------------------------------------------------------------------
     // Set up/tear down
@@ -104,8 +101,8 @@
         categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID );
         
         periodService = (PeriodService) getBean( PeriodService.ID );
-        
-        sourceStore = (SourceStore) getBean( SourceStore.ID );
+
+        organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
         
         // ---------------------------------------------------------------------
         // Add supporting data
@@ -126,15 +123,15 @@
         periodC = createPeriod( getDay( 7 ), getDay( 8 ) );
         periodD = createPeriod( getDay( 8 ), getDay( 9 ) );
         
-        sourceA = new MockSource( "SourceA" );
-        sourceB = new MockSource( "SourceB" );
-        sourceC = new MockSource( "SourceC" );
-        sourceD = new MockSource( "SourceD" );
+        sourceA = createOrganisationUnit( 'A' );
+        sourceB = createOrganisationUnit( 'B' );
+        sourceC = createOrganisationUnit( 'C' );
+        sourceD = createOrganisationUnit( 'D' );
 
-        sourceStore.addSource( sourceA );
-        sourceStore.addSource( sourceB );
-        sourceStore.addSource( sourceC );
-        sourceStore.addSource( sourceD );
+        organisationUnitService.addOrganisationUnit( sourceA );
+        organisationUnitService.addOrganisationUnit( sourceB );
+        organisationUnitService.addOrganisationUnit( sourceC );
+        organisationUnitService.addOrganisationUnit( sourceD );
 
         optionCombo = new DataElementCategoryOptionCombo();
         
@@ -473,7 +470,7 @@
         dataValueService.addDataValue( dataValueC );
         dataValueService.addDataValue( dataValueD );
 
-        Collection<Source> sources = new HashSet<Source>();
+        Collection<OrganisationUnit> sources = new HashSet<OrganisationUnit>();
         sources.add( sourceA );
         sources.add( sourceB );
 
@@ -547,7 +544,7 @@
         periods.add( periodA );
         periods.add( periodB );
 
-        Collection<Source> sources = new HashSet<Source>();
+        Collection<OrganisationUnit> sources = new HashSet<OrganisationUnit>();
         sources.add( sourceA );
         sources.add( sourceB );
         
@@ -580,7 +577,7 @@
         periods.add( periodA );
         periods.add( periodB );
 
-        Collection<Source> sources = new HashSet<Source>();
+        Collection<OrganisationUnit> sources = new HashSet<OrganisationUnit>();
         sources.add( sourceA );
         sources.add( sourceB );
         

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueStoreTest.java	2011-02-15 12:55:14 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueStoreTest.java	2011-04-22 21:04:14 +0000
@@ -41,11 +41,10 @@
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
 import org.hisp.dhis.dataelement.DataElementStore;
-import org.hisp.dhis.mock.MockSource;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodStore;
-import org.hisp.dhis.source.Source;
-import org.hisp.dhis.source.SourceStore;
 import org.junit.Test;
 
 /**
@@ -61,8 +60,6 @@
     
     private PeriodStore periodStore;
 
-    private SourceStore sourceStore;
-
     // -------------------------------------------------------------------------
     // Supporting data
     // -------------------------------------------------------------------------
@@ -85,13 +82,13 @@
 
     private Period periodD;
 
-    private Source sourceA;
-
-    private Source sourceB;
-
-    private Source sourceC;
-
-    private Source sourceD;
+    private OrganisationUnit sourceA;
+
+    private OrganisationUnit sourceB;
+
+    private OrganisationUnit sourceC;
+
+    private OrganisationUnit sourceD;
 
     // -------------------------------------------------------------------------
     // Set up/tear down
@@ -108,8 +105,8 @@
         categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID );
         
         periodStore = (PeriodStore) getBean( PeriodStore.ID );
-        
-        sourceStore = (SourceStore) getBean( SourceStore.ID );
+
+        organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
         
         // ---------------------------------------------------------------------
         // Add supporting data
@@ -135,15 +132,15 @@
         periodStore.addPeriod( periodC );
         periodStore.addPeriod( periodD );
 
-        sourceA = new MockSource( "SourceA" );
-        sourceB = new MockSource( "SourceB" );
-        sourceC = new MockSource( "SourceC" );
-        sourceD = new MockSource( "SourceD" );
+        sourceA = createOrganisationUnit( 'A' );
+        sourceB = createOrganisationUnit( 'B' );
+        sourceC = createOrganisationUnit( 'C' );
+        sourceD = createOrganisationUnit( 'D' );
 
-        sourceStore.addSource( sourceA );
-        sourceStore.addSource( sourceB );
-        sourceStore.addSource( sourceC );
-        sourceStore.addSource( sourceD );        
+        organisationUnitService.addOrganisationUnit( sourceA );
+        organisationUnitService.addOrganisationUnit( sourceB );
+        organisationUnitService.addOrganisationUnit( sourceC );
+        organisationUnitService.addOrganisationUnit( sourceD );        
 
         optionCombo = new DataElementCategoryOptionCombo();
         
@@ -481,7 +478,7 @@
         dataValueStore.addDataValue( dataValueC );
         dataValueStore.addDataValue( dataValueD );
 
-        Collection<Source> sources = new HashSet<Source>();
+        Collection<OrganisationUnit> sources = new HashSet<OrganisationUnit>();
         sources.add( sourceA );
         sources.add( sourceB );
 
@@ -555,7 +552,7 @@
         periods.add( periodA );
         periods.add( periodB );
 
-        Collection<Source> sources = new HashSet<Source>();
+        Collection<OrganisationUnit> sources = new HashSet<OrganisationUnit>();
         sources.add( sourceA );
         sources.add( sourceB );
         
@@ -588,7 +585,7 @@
         periods.add( periodA );
         periods.add( periodB );
 
-        Collection<Source> sources = new HashSet<Source>();
+        Collection<OrganisationUnit> sources = new HashSet<OrganisationUnit>();
         sources.add( sourceA );
         sources.add( sourceB );
         

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/expression/ExpressionServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/expression/ExpressionServiceTest.java	2010-12-06 09:27:07 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/expression/ExpressionServiceTest.java	2011-04-22 21:04:14 +0000
@@ -31,7 +31,7 @@
 import static junit.framework.Assert.assertNotNull;
 import static junit.framework.Assert.assertNull;
 import static junit.framework.Assert.assertTrue;
-import static org.hisp.dhis.expression.Expression.*;
+import static org.hisp.dhis.expression.Expression.SEPARATOR;
 
 import java.util.Collection;
 import java.util.HashMap;
@@ -49,10 +49,9 @@
 import org.hisp.dhis.dataelement.DataElementOperand;
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.datavalue.DataValueService;
-import org.hisp.dhis.mock.MockSource;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.period.Period;
-import org.hisp.dhis.source.Source;
-import org.hisp.dhis.source.SourceStore;
 import org.junit.Test;
 
 /**
@@ -61,9 +60,7 @@
  */
 public class ExpressionServiceTest
     extends DhisTest
-{        
-    private SourceStore sourceStore;
-    
+{
     private DataElementCategoryOption categoryOptionA;
     private DataElementCategoryOption categoryOptionB;
     private DataElementCategoryOption categoryOptionC;
@@ -82,7 +79,7 @@
     
     private Period period;
     
-    private Source source;
+    private OrganisationUnit source;
     
     private int dataElementIdA;
     private int dataElementIdB;
@@ -119,7 +116,7 @@
         
         dataValueService = (DataValueService) getBean( DataValueService.ID );
         
-        sourceStore = (SourceStore) getBean( SourceStore.ID );
+        organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
         
         categoryOptionA = new DataElementCategoryOption( "Under 5" );
         categoryOptionB = new DataElementCategoryOption( "Over 5" );
@@ -166,9 +163,9 @@
         
         period = createPeriod( getDate( 2000, 1, 1 ), getDate( 2000, 2, 1 ) );
         
-        source = new MockSource( "SourceA" );
+        source = createOrganisationUnit( 'A' );
         
-        sourceStore.addSource( source );
+        organisationUnitService.addOrganisationUnit( source );
         
         expressionA = "[" + dataElementIdA + SEPARATOR + categoryOptionComboId + "]+[" + dataElementIdB + SEPARATOR + categoryOptionComboId + "]";
         expressionB = "[" + dataElementIdC + SEPARATOR + categoryOptionComboId + "]-[" + dataElementIdD + SEPARATOR + categoryOptionComboId + "]";

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/period/PeriodServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/period/PeriodServiceTest.java	2011-03-11 08:13:14 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/period/PeriodServiceTest.java	2011-04-22 21:04:14 +0000
@@ -46,9 +46,8 @@
 import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.datavalue.DataValue;
 import org.hisp.dhis.datavalue.DataValueService;
-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;
 
 /**
@@ -62,8 +61,6 @@
     
     private DataElementService dataElementService;
     
-    private SourceStore sourceStore;
-    
     private DataValueService dataValueService;
 
     private DataElementCategoryOptionCombo optionCombo;
@@ -80,8 +77,8 @@
         dataElementService = (DataElementService) getBean( DataElementService.ID );
 
         categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID );
-        
-        sourceStore = (SourceStore) getBean( SourceStore.ID );
+
+        organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
         
         dataValueService = (DataValueService) getBean( DataValueService.ID );
 
@@ -498,9 +495,9 @@
         Period w04 = new Period( weekly, getDate( 2008, 1, 21 ), getDate( 2008, 1, 27 ) );
         Period w05 = new Period( weekly, getDate( 2008, 1, 28 ), getDate( 2008, 2, 3 ) );
                 
-        Source sourceA = new MockSource( "SourceA" );
-        Source sourceB = new MockSource( "SourceB" );
-        Source sourceC = new MockSource( "SourceC" );
+        OrganisationUnit sourceA = createOrganisationUnit( 'A' );
+        OrganisationUnit sourceB = createOrganisationUnit( 'B' );
+        OrganisationUnit sourceC = createOrganisationUnit( 'C' );
         
         DataValue dataValueA = new DataValue( dataElementA, jan, sourceA, optionCombo );
         dataValueA.setValue( "1" );
@@ -525,9 +522,9 @@
         dataElementService.addDataElement( dataElementB );
         dataElementService.addDataElement( dataElementC );
      
-        sourceStore.addSource( sourceA );
-        sourceStore.addSource( sourceB );
-        sourceStore.addSource( sourceC );
+        organisationUnitService.addOrganisationUnit( sourceA );
+        organisationUnitService.addOrganisationUnit( sourceB );
+        organisationUnitService.addOrganisationUnit( sourceC );
         
         dataValueService.addDataValue( dataValueA );
         dataValueService.addDataValue( dataValueB );
@@ -548,12 +545,12 @@
         
         dataElements2.add( dataElementC );
         
-        Collection<Source> sources1 = new ArrayList<Source>();
+        Collection<OrganisationUnit> sources1 = new ArrayList<OrganisationUnit>();
         
         sources1.add( sourceA );
         sources1.add( sourceB );
         
-        Collection<Source> sources2 = new ArrayList<Source>();
+        Collection<OrganisationUnit> sources2 = new ArrayList<OrganisationUnit>();
         
         sources2.add( sourceC );
         

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/period/PeriodStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/period/PeriodStoreTest.java	2011-03-11 08:13:14 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/period/PeriodStoreTest.java	2011-04-22 21:04:14 +0000
@@ -46,9 +46,8 @@
 import org.hisp.dhis.dataelement.DataElementStore;
 import org.hisp.dhis.datavalue.DataValue;
 import org.hisp.dhis.datavalue.DataValueStore;
-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;
 
 /**
@@ -62,8 +61,6 @@
     
     private DataElementStore dataElementStore;
 
-    private SourceStore sourceStore;
-    
     private DataValueStore dataValueStore;
 
     private DataElementCategoryOptionCombo optionCombo;
@@ -81,8 +78,8 @@
         dataElementStore = (DataElementStore) getBean( DataElementStore.ID );
 
         categoryService = (DataElementCategoryService) getBean( DataElementCategoryService.ID );
-        
-        sourceStore = (SourceStore) getBean( SourceStore.ID );
+
+        organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
         
         dataValueStore = (DataValueStore) getBean( DataValueStore.ID );
 
@@ -554,9 +551,9 @@
         Period w04 = new Period( weekly, getDate( 2008, 1, 21 ), getDate( 2008, 1, 27 ) );
         Period w05 = new Period( weekly, getDate( 2008, 1, 28 ), getDate( 2008, 2, 3 ) );
                 
-        Source sourceA = new MockSource( "SourceA" );
-        Source sourceB = new MockSource( "SourceB" );
-        Source sourceC = new MockSource( "SourceC" );
+        OrganisationUnit sourceA = createOrganisationUnit( 'A' );
+        OrganisationUnit sourceB = createOrganisationUnit( 'B' );
+        OrganisationUnit sourceC = createOrganisationUnit( 'C' );
         
         DataValue dataValueA = new DataValue( dataElementA, jan, sourceA, optionCombo );
         dataValueA.setValue( "1" );
@@ -581,9 +578,9 @@
         dataElementStore.addDataElement( dataElementB );
         dataElementStore.addDataElement( dataElementC );
      
-        sourceStore.addSource( sourceA );
-        sourceStore.addSource( sourceB );
-        sourceStore.addSource( sourceC );
+        organisationUnitService.addOrganisationUnit( sourceA );
+        organisationUnitService.addOrganisationUnit( sourceB );
+        organisationUnitService.addOrganisationUnit( sourceC );
         
         dataValueStore.addDataValue( dataValueA );
         dataValueStore.addDataValue( dataValueB );
@@ -604,12 +601,12 @@
         
         dataElements2.add( dataElementC );
         
-        Collection<Source> sources1 = new ArrayList<Source>();
+        Collection<OrganisationUnit> sources1 = new ArrayList<OrganisationUnit>();
         
         sources1.add( sourceA );
         sources1.add( sourceB );
         
-        Collection<Source> sources2 = new ArrayList<Source>();
+        Collection<OrganisationUnit> sources2 = new ArrayList<OrganisationUnit>();
         
         sources2.add( sourceC );
         

=== removed directory 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/source'
=== removed file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/source/SourceStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/source/SourceStoreTest.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/source/SourceStoreTest.java	1970-01-01 00:00:00 +0000
@@ -1,126 +0,0 @@
-package org.hisp.dhis.source;
-
-/*
- * Copyright (c) 2004-2010, 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 static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertNull;
-
-import org.hisp.dhis.DhisSpringTest;
-import org.hisp.dhis.mock.MockSource;
-import org.junit.Test;
-
-/**
- * @author Torgeir Lorange Ostby
- * @version $Id: SourceStoreTest.java 3200 2007-03-29 11:51:17Z torgeilo $
- */
-public class SourceStoreTest
-    extends DhisSpringTest
-{
-    private SourceStore sourceStore;
-
-    // -------------------------------------------------------------------------
-    // Set up/tear down
-    // -------------------------------------------------------------------------
-
-    @Override
-    public void setUpTest()
-        throws Exception
-    {
-        sourceStore = (SourceStore) getBean( SourceStore.ID );
-    }
-
-    // -------------------------------------------------------------------------
-    // Tests
-    // -------------------------------------------------------------------------
-
-    @Test
-    public void addGetSource()
-    {
-        Source sourceA = new MockSource( "SourceA" );
-        Source sourceB = new MockSource( "SourceB" );
-        
-        int idA = sourceStore.addSource( sourceA );
-        int idB = sourceStore.addSource( sourceB );
-        
-        assertEquals( sourceA, sourceStore.getSource( idA ) );
-        assertEquals( sourceB, sourceStore.getSource( idB ) );        
-    }
-    
-    @Test
-    public void updateSource()
-    {
-        MockSource source = new MockSource( "SourceA" );
-        
-        int id = sourceStore.addSource( source );
-        
-        assertEquals( source, sourceStore.getSource( id ) );
-        
-        source.setName( "SourceB" );
-        
-        sourceStore.updateSource( source );
-        
-        assertEquals( source, sourceStore.getSource( id ) );
-    }
-    
-    @Test
-    public void delete()
-    {
-        Source sourceA = new MockSource( "SourceA" );
-        Source sourceB = new MockSource( "SourceB" );
-        
-        int idA = sourceStore.addSource( sourceA );
-        int idB = sourceStore.addSource( sourceB );
-        
-        assertNotNull( sourceStore.getSource( idA ) );
-        assertNotNull( sourceStore.getSource( idB ) );
-        
-        sourceStore.deleteSource( sourceA );
-        
-        assertNull( sourceStore.getSource( idA ) );
-        assertNotNull( sourceStore.getSource( idB ) );
-        
-        sourceStore.deleteSource( sourceB );
-        
-        assertNull( sourceStore.getSource( idA ) );
-        assertNull( sourceStore.getSource( idB ) );        
-    }
-    
-    @Test
-    public void getAll()
-    {
-        Source sourceA = new MockSource( "SourceA" );
-        Source sourceB = new MockSource( "SourceB" );
-        
-        sourceStore.addSource( sourceA );
-        sourceStore.addSource( sourceB );
-                
-        assertNotNull( sourceStore.getAllSources() );
-        assertEquals( sourceStore.getAllSources().size(), 2 );
-    }
-}

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleServiceTest.java	2011-04-22 17:02:27 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleServiceTest.java	2011-04-22 21:04:14 +0000
@@ -61,12 +61,11 @@
 import org.hisp.dhis.expression.ExpressionService;
 import org.hisp.dhis.jdbc.batchhandler.AggregatedDataValueBatchHandler;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.period.MonthlyPeriodType;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.period.PeriodType;
-import org.hisp.dhis.source.Source;
-import org.hisp.dhis.source.SourceStore;
 import org.hisp.dhis.system.util.MathUtils;
 import org.junit.Test;
 
@@ -121,7 +120,7 @@
 
     private OrganisationUnit sourceB;
 
-    private Set<Source> sourcesA = new HashSet<Source>();
+    private Set<OrganisationUnit> sourcesA = new HashSet<OrganisationUnit>();
 
     private ValidationRule validationRuleA;
 
@@ -155,10 +154,10 @@
 
         dataSetService = (DataSetService) getBean( DataSetService.ID );
 
-        sourceStore = (SourceStore) getBean( SourceStore.ID );
-
         dataValueService = (DataValueService) getBean( DataValueService.ID );
 
+        organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
+        
         periodService = (PeriodService) getBean( PeriodService.ID );
 
         periodType = new MonthlyPeriodType();
@@ -207,8 +206,8 @@
         sourceA.getDataSets().add( dataSet );
         sourceB.getDataSets().add( dataSet );
 
-        sourceStore.addSource( sourceA );
-        sourceStore.addSource( sourceB );
+        organisationUnitService.addOrganisationUnit( sourceA );
+        organisationUnitService.addOrganisationUnit( sourceB );
 
         sourcesA.add( sourceA );
         sourcesA.add( sourceB );
@@ -263,7 +262,7 @@
         periods.add( periodA );
         periods.add( periodB );
         
-        List<Source> sources = new ArrayList<Source>();
+        List<OrganisationUnit> sources = new ArrayList<OrganisationUnit>();
         sources.add( sourceA );
         sources.add( sourceB );
         

=== removed directory 'dhis-2/dhis-services/dhis-service-core/src/test/resources/org'
=== removed directory 'dhis-2/dhis-services/dhis-service-core/src/test/resources/org/hisp'
=== removed directory 'dhis-2/dhis-services/dhis-service-core/src/test/resources/org/hisp/dhis'
=== removed directory 'dhis-2/dhis-services/dhis-service-core/src/test/resources/org/hisp/dhis/source'
=== removed directory 'dhis-2/dhis-services/dhis-service-core/src/test/resources/org/hisp/dhis/source/hibernate'
=== removed file 'dhis-2/dhis-services/dhis-service-core/src/test/resources/org/hisp/dhis/source/hibernate/MockSource.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/test/resources/org/hisp/dhis/source/hibernate/MockSource.hbm.xml	2009-07-06 17:45:57 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/resources/org/hisp/dhis/source/hibernate/MockSource.hbm.xml	1970-01-01 00:00:00 +0000
@@ -1,14 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC
-  "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
-  "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd";>
-
-<hibernate-mapping>
-  <joined-subclass name="org.hisp.dhis.mock.MockSource"
-    extends="org.hisp.dhis.source.Source" table="mocksource">
-    <key column="id"/>
-    <property name="name">
-      <column name="name" not-null="true" unique="true"/>
-    </property>
-  </joined-subclass>
-</hibernate-mapping>

=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/DataMartExportDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/DataMartExportDeletionHandler.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/DataMartExportDeletionHandler.java	2011-04-22 21:04:14 +0000
@@ -2,8 +2,8 @@
 
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.indicator.Indicator;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
-import org.hisp.dhis.source.Source;
 import org.hisp.dhis.system.deletion.DeletionHandler;
 
 /*
@@ -98,11 +98,11 @@
     }
     
     @Override
-    public void deleteSource( Source source )
+    public void deleteOrganisationUnit( OrganisationUnit unit )
     {
         for ( DataMartExport export : dataMartService.getAllDataMartExports() )
         {
-            if ( export.getOrganisationUnits().remove( source ) )
+            if ( export.getOrganisationUnits().remove( unit ) )
             {
                 dataMartService.saveDataMartExport( export );
             }

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/importer/DefaultDhis14FileImportService.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/importer/DefaultDhis14FileImportService.java	2011-04-22 13:43:13 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/importer/DefaultDhis14FileImportService.java	2011-04-22 21:04:14 +0000
@@ -103,7 +103,6 @@
 import org.hisp.dhis.jdbc.batchhandler.OrganisationUnitGroupBatchHandler;
 import org.hisp.dhis.jdbc.batchhandler.OrganisationUnitGroupMemberBatchHandler;
 import org.hisp.dhis.jdbc.batchhandler.PeriodBatchHandler;
-import org.hisp.dhis.jdbc.batchhandler.SourceBatchHandler;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
@@ -111,7 +110,6 @@
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
-import org.hisp.dhis.source.Source;
 
 import com.ibatis.sqlmap.client.event.RowHandler;
 
@@ -511,11 +509,9 @@
     {
         state.setMessage( "importing_organisation_units" );
         
-        BatchHandler<Source> sourceBatchHandler = batchHandlerFactory.createBatchHandler( SourceBatchHandler.class ).init();
         BatchHandler<OrganisationUnit> organisationUnitBatchHandler = batchHandlerFactory.createBatchHandler( OrganisationUnitBatchHandler.class ).init();
         
         RowHandler rowHandler = new OrganisationUnitRowHandler( organisationUnitBatchHandler, 
-            sourceBatchHandler,
             importObjectService,
             organisationUnitService,
             params,
@@ -523,7 +519,6 @@
         
         queryManager.queryWithRowhandler( "getOrganisationUnits", rowHandler );
         
-        sourceBatchHandler.flush();
         organisationUnitBatchHandler.flush();
         
         log.info( "Imported OrganisationUnits" );       

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/OrganisationUnitRowHandler.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/OrganisationUnitRowHandler.java	2010-08-03 11:34:19 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/OrganisationUnitRowHandler.java	2011-04-22 21:04:14 +0000
@@ -34,7 +34,6 @@
 import org.hisp.dhis.importexport.importer.OrganisationUnitImporter;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.source.Source;
 import org.hisp.dhis.system.util.UUIdUtils;
 
 import com.ibatis.sqlmap.client.event.RowHandler;
@@ -53,14 +52,12 @@
     // -------------------------------------------------------------------------
 
     public OrganisationUnitRowHandler( BatchHandler<OrganisationUnit> batchHandler, 
-        BatchHandler<Source> sourceBatchHandler,
         ImportObjectService importObjectService,
         OrganisationUnitService organisationUnitService,
         ImportParams params,
         ImportAnalyser importAnalyser )
     {
         this.batchHandler = batchHandler;
-        this.sourceBatchHandler = sourceBatchHandler;
         this.importObjectService = importObjectService;
         this.organisationUnitService = organisationUnitService;
         this.params = params;

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/RoutineDataValueRowHandler.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/RoutineDataValueRowHandler.java	2010-11-19 15:25:29 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/RoutineDataValueRowHandler.java	2011-04-22 21:04:14 +0000
@@ -41,7 +41,6 @@
 import org.hisp.dhis.importexport.importer.DataValueImporter;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
-import org.hisp.dhis.source.Source;
 
 import com.ibatis.sqlmap.client.event.RowHandler;
 
@@ -64,7 +63,7 @@
     
     private Period period;
     
-    private Source source;
+    private OrganisationUnit source;
     
     private DataValue value;
     

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/SemiPermanentDataValueRowHandler.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/SemiPermanentDataValueRowHandler.java	2010-11-19 15:25:29 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dhis14/file/rowhandler/SemiPermanentDataValueRowHandler.java	2011-04-22 21:04:14 +0000
@@ -41,7 +41,6 @@
 import org.hisp.dhis.importexport.importer.DataValueImporter;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
-import org.hisp.dhis.source.Source;
 
 import com.ibatis.sqlmap.client.event.RowHandler;
 
@@ -62,7 +61,7 @@
     
     private DataElement element;
 
-    private Source source;
+    private OrganisationUnit source;
     
     private DataValue value;   
     

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DXFConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DXFConverter.java	2011-02-02 17:56:01 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DXFConverter.java	2011-04-22 21:04:14 +0000
@@ -107,7 +107,6 @@
 import org.hisp.dhis.jdbc.batchhandler.OrganisationUnitGroupMemberBatchHandler;
 import org.hisp.dhis.jdbc.batchhandler.PeriodBatchHandler;
 import org.hisp.dhis.jdbc.batchhandler.ReportTableBatchHandler;
-import org.hisp.dhis.jdbc.batchhandler.SourceBatchHandler;
 import org.hisp.dhis.olap.OlapURLService;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
@@ -119,7 +118,6 @@
 import org.hisp.dhis.report.ReportService;
 import org.hisp.dhis.reporttable.ReportTable;
 import org.hisp.dhis.reporttable.ReportTableService;
-import org.hisp.dhis.source.Source;
 import org.hisp.dhis.validation.ValidationRuleService;
 
 /**
@@ -719,18 +717,14 @@
             else if ( reader.isStartElement( OrganisationUnitConverter.COLLECTION_NAME ) )
             {
                 state.setMessage( "importing_organisation_units" );
-
-                BatchHandler<Source> sourceBatchHandler = batchHandlerFactory.createBatchHandler(
-                    SourceBatchHandler.class ).init();
+                
                 BatchHandler<OrganisationUnit> batchHandler = batchHandlerFactory.createBatchHandler(
                     OrganisationUnitBatchHandler.class ).init();
 
-                XMLConverter converter = new OrganisationUnitConverter( batchHandler, sourceBatchHandler,
-                    importObjectService, organisationUnitService, importAnalyser );
+                XMLConverter converter = new OrganisationUnitConverter( batchHandler, importObjectService, organisationUnitService, importAnalyser );
 
                 converterInvoker.invokeRead( converter, reader, params );
 
-                sourceBatchHandler.flush();
                 batchHandler.flush();
 
                 log.info( "Imported OrganisationUnits" );

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataSetSourceAssociationConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataSetSourceAssociationConverter.java	2010-05-29 16:06:56 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataSetSourceAssociationConverter.java	2011-04-22 21:04:14 +0000
@@ -46,7 +46,6 @@
 import org.hisp.dhis.importexport.importer.GroupMemberImporter;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.source.Source;
 
 /**
  * @author Lars Helge Overland
@@ -119,7 +118,7 @@
             {
                 if ( dataSet.getSources() != null )
                 {
-                    for ( Source source : dataSet.getSources() )
+                    for ( OrganisationUnit source : dataSet.getSources() )
                     {
                         if ( units.contains( source ) )
                         {

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataValueConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataValueConverter.java	2010-08-31 05:47:11 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataValueConverter.java	2011-04-22 21:04:14 +0000
@@ -48,7 +48,6 @@
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
-import org.hisp.dhis.source.Source;
 import org.hisp.dhis.system.util.DateUtils;
 
 /**
@@ -170,7 +169,7 @@
     }
     
     public void read( XMLReader reader, ImportParams params )
-    {      
+    {
         while ( reader.moveToStartElement( ELEMENT_NAME, COLLECTION_NAME ) )
         {
             final Map<String, String> values = reader.readElements( ELEMENT_NAME );
@@ -183,7 +182,7 @@
             final Period period = new Period();          
             value.setPeriod( period );
             
-            final Source source = new OrganisationUnit();
+            final OrganisationUnit source = new OrganisationUnit();
             value.setSource( source );
 
             final DataElementCategoryOptionCombo categoryOptionCombo = new DataElementCategoryOptionCombo();

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/OrganisationUnitConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/OrganisationUnitConverter.java	2010-12-23 11:56:44 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/OrganisationUnitConverter.java	2011-04-22 21:04:14 +0000
@@ -27,7 +27,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.hisp.dhis.importexport.dxf.converter.DXFConverter.*;
+import static org.hisp.dhis.importexport.dxf.converter.DXFConverter.MINOR_VERSION_11;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -45,7 +45,6 @@
 import org.hisp.dhis.organisationunit.CoordinatesTuple;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.source.Source;
 import org.hisp.dhis.system.util.DateUtils;
 
 /**
@@ -94,13 +93,11 @@
      * @param importObjectService the importObjectService to use.
      */
     public OrganisationUnitConverter( BatchHandler<OrganisationUnit> batchHandler, 
-        BatchHandler<Source> sourceBatchHandler, 
         ImportObjectService importObjectService, 
         OrganisationUnitService organisationUnitService,
         ImportAnalyser importAnalyser )
     {
         this.batchHandler = batchHandler;
-        this.sourceBatchHandler = sourceBatchHandler;
         this.importObjectService = importObjectService;
         this.organisationUnitService = organisationUnitService;
         this.importAnalyser = importAnalyser;

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/service/DataSetMapper.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/service/DataSetMapper.java	2011-02-25 18:08:38 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf2/service/DataSetMapper.java	2011-04-22 21:04:14 +0000
@@ -25,7 +25,7 @@
         dxfDataSet.setId( dataSet.getUuid() );
 
         dxfDataSet.setDataElements( getDataElements( dataSet.getDataElements() ) );
-        dxfDataSet.setOrgUnitLinks( linkBuilder.getLinks( dataSet.getOrganisationUnits() ) );
+        dxfDataSet.setOrgUnitLinks( linkBuilder.getLinks( dataSet.getSources() ) );
 
         return dxfDataSet;
     }

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/importer/OrganisationUnitImporter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/importer/OrganisationUnitImporter.java	2011-02-02 17:56:01 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/importer/OrganisationUnitImporter.java	2011-04-22 21:04:14 +0000
@@ -36,7 +36,6 @@
 import org.hisp.dhis.importexport.mapping.NameMappingUtil;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.source.Source;
 
 /**
  * @author Lars Helge Overland
@@ -47,16 +46,13 @@
 {
     protected OrganisationUnitService organisationUnitService;
 
-    protected BatchHandler<Source> sourceBatchHandler;
-
     public OrganisationUnitImporter()
     {
     }
     
-    public OrganisationUnitImporter( BatchHandler<OrganisationUnit> batchHandler, BatchHandler<Source> sourceBatchHandler, OrganisationUnitService organisationUnitService )
+    public OrganisationUnitImporter( BatchHandler<OrganisationUnit> batchHandler, OrganisationUnitService organisationUnitService )
     {
         this.batchHandler = batchHandler;
-        this.sourceBatchHandler = sourceBatchHandler;
         this.organisationUnitService = organisationUnitService;
     }
     
@@ -71,10 +67,6 @@
     @Override
     protected void importUnique( OrganisationUnit object )
     {
-        int id = sourceBatchHandler.insertObject( object, true );
-        
-        object.setId( id );
-        
         batchHandler.addObject( object );
     }
 

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/service/DefaultImportObjectManager.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/service/DefaultImportObjectManager.java	2011-04-21 15:24:52 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/service/DefaultImportObjectManager.java	2011-04-22 21:04:14 +0000
@@ -132,7 +132,6 @@
 import org.hisp.dhis.jdbc.batchhandler.OrganisationUnitGroupMemberBatchHandler;
 import org.hisp.dhis.jdbc.batchhandler.PeriodBatchHandler;
 import org.hisp.dhis.jdbc.batchhandler.ReportTableBatchHandler;
-import org.hisp.dhis.jdbc.batchhandler.SourceBatchHandler;
 import org.hisp.dhis.olap.OlapURL;
 import org.hisp.dhis.olap.OlapURLService;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -147,7 +146,6 @@
 import org.hisp.dhis.report.ReportService;
 import org.hisp.dhis.reporttable.ReportTable;
 import org.hisp.dhis.reporttable.ReportTableService;
-import org.hisp.dhis.source.Source;
 import org.hisp.dhis.validation.ValidationRule;
 import org.hisp.dhis.validation.ValidationRuleService;
 import org.springframework.transaction.annotation.Transactional;
@@ -781,22 +779,18 @@
     @Transactional
     public void importOrganisationUnits()
     {
-        BatchHandler<Source> sourceBatchHandler = batchHandlerFactory.createBatchHandler( SourceBatchHandler.class )
-            .init();
         BatchHandler<OrganisationUnit> organisationUnitBatchHandler = batchHandlerFactory.createBatchHandler(
             OrganisationUnitBatchHandler.class ).init();
 
         Collection<ImportObject> importObjects = importObjectStore.getImportObjects( OrganisationUnit.class );
 
-        Importer<OrganisationUnit> importer = new OrganisationUnitImporter( organisationUnitBatchHandler,
-            sourceBatchHandler, organisationUnitService );
+        Importer<OrganisationUnit> importer = new OrganisationUnitImporter( organisationUnitBatchHandler, organisationUnitService );
 
         for ( ImportObject importObject : importObjects )
         {
             importer.importObject( (OrganisationUnit) importObject.getObject(), params );
         }
 
-        sourceBatchHandler.flush();
         organisationUnitBatchHandler.flush();
 
         importObjectStore.deleteImportObjects( OrganisationUnit.class );

=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/PatientDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/PatientDeletionHandler.java	2011-03-31 01:55:06 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/PatientDeletionHandler.java	2011-04-22 21:04:14 +0000
@@ -1,7 +1,33 @@
 package org.hisp.dhis.patient;
 
+/*
+ * Copyright (c) 2004-2010, 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 org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.source.Source;
 import org.hisp.dhis.system.deletion.DeletionHandler;
 
 public class PatientDeletionHandler
@@ -29,12 +55,11 @@
     }
 
     @Override
-    public void deleteSource( Source source )
+    public void deleteOrganisationUnit( OrganisationUnit unit )
     {
-        for ( Patient patient : patientService.getPatients( (OrganisationUnit) source ) )
+        for ( Patient patient : patientService.getPatients( unit ) )
         {
             patientService.deletePatient( patient );
         }
     }
-
 }

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/ChartDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/ChartDeletionHandler.java	2010-04-21 14:32:54 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/ChartDeletionHandler.java	2011-04-22 21:04:14 +0000
@@ -28,8 +28,8 @@
  */
 
 import org.hisp.dhis.indicator.Indicator;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
-import org.hisp.dhis.source.Source;
 import org.hisp.dhis.system.deletion.DeletionHandler;
 
 /**
@@ -89,11 +89,11 @@
     }
 
     @Override
-    public void deleteSource( Source source )
+    public void deleteOrganisationUnit( OrganisationUnit unit )
     {
         for ( Chart chart : chartService.getAllCharts() )
         {
-            if ( chart.getOrganisationUnits().remove( source ) )
+            if ( chart.getOrganisationUnits().remove( unit ) )
             {
                 chartService.saveChart( chart );
             }

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/ReportTableDeletionHandler.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/ReportTableDeletionHandler.java	2010-05-26 15:47:51 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/ReportTableDeletionHandler.java	2011-04-22 21:04:14 +0000
@@ -31,8 +31,8 @@
 import org.hisp.dhis.dataelement.DataElementCategoryCombo;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.indicator.Indicator;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
-import org.hisp.dhis.source.Source;
 import org.hisp.dhis.system.deletion.DeletionHandler;
 
 /**
@@ -120,11 +120,11 @@
     }
 
     @Override
-    public void deleteSource( Source source )
+    public void deleteOrganisationUnit( OrganisationUnit unit )
     {
         for ( ReportTable reportTable : reportTableService.getAllReportTables() )
         {
-            if ( reportTable.getUnits().remove( source ) )
+            if ( reportTable.getUnits().remove( unit ) )
             {
                 reportTableService.updateReportTable( reportTable );
             }

=== modified file 'dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/ehcache.xml'
--- dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/ehcache.xml	2011-04-22 17:09:12 +0000
+++ dhis-2/dhis-support/dhis-support-hibernate/src/main/resources/ehcache.xml	2011-04-22 21:04:14 +0000
@@ -73,7 +73,7 @@
   />
   
   <cache name="org.hisp.dhis.organisationunit.OrganisationUnit"
-    maxElementsInMemory="10000"
+    maxElementsInMemory="20000"
   />
   
   <cache name="org.hisp.dhis.user.User"

=== removed file 'dhis-2/dhis-support/dhis-support-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/SourceOrganisationUnitBatchHandlerTest.java'
--- dhis-2/dhis-support/dhis-support-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/SourceOrganisationUnitBatchHandlerTest.java	2010-05-17 19:31:07 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/SourceOrganisationUnitBatchHandlerTest.java	1970-01-01 00:00:00 +0000
@@ -1,182 +0,0 @@
-package org.hisp.dhis.jdbc.batchhandler;
-
-/*
- * Copyright (c) 2004-2010, 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 static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertFalse;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertTrue;
-
-import java.util.Collection;
-
-import org.amplecode.quick.BatchHandler;
-import org.amplecode.quick.BatchHandlerFactory;
-import org.hisp.dhis.DhisTest;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.source.Source;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-
-/**
- * @author Lars Helge Overland
- * @version $Id: SourceOrganisationUnitBatchHandlerTest.java 4949 2008-04-21 07:59:54Z larshelg $
- */
-public class SourceOrganisationUnitBatchHandlerTest
-    extends DhisTest
-{
-    @Autowired
-    private BatchHandlerFactory batchHandlerFactory;
-    
-    private BatchHandler<Source> sourceBatchHandler;
-    
-    private BatchHandler<OrganisationUnit> organisationUnitbatchHandler;
-    
-    private OrganisationUnit unitA;
-    private OrganisationUnit unitB;
-    private OrganisationUnit unitC;
-    
-    // -------------------------------------------------------------------------
-    // Fixture
-    // -------------------------------------------------------------------------
-
-    @Override
-    public void setUpTest()
-    {
-        organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
-
-        sourceBatchHandler = batchHandlerFactory.createBatchHandler( SourceBatchHandler.class );
-        
-        organisationUnitbatchHandler = batchHandlerFactory.createBatchHandler( OrganisationUnitBatchHandler.class );
-
-        sourceBatchHandler.init();
-        
-        organisationUnitbatchHandler.init();
-        
-        unitA = createOrganisationUnit( 'A' );
-        unitB = createOrganisationUnit( 'B' );
-        unitC = createOrganisationUnit( 'C' );
-    }
-
-    @Override
-    public void tearDownTest()
-    {
-        sourceBatchHandler.flush();
-        organisationUnitbatchHandler.flush();
-    }
-    
-    @Override
-    public boolean emptyDatabaseAfterTest()
-    {
-        return true;
-    }
-    
-    // -------------------------------------------------------------------------
-    // Tests
-    // -------------------------------------------------------------------------
-
-    @Test
-    public void testAddObject()
-    {
-        int idA = sourceBatchHandler.insertObject( unitA, true );
-        int idB = sourceBatchHandler.insertObject( unitB, true );
-        int idC = sourceBatchHandler.insertObject( unitC, true );
-        
-        unitA.setId( idA );
-        unitB.setId( idB );
-        unitC.setId( idC );        
-        
-        organisationUnitbatchHandler.addObject( unitA );
-        organisationUnitbatchHandler.addObject( unitB );
-        organisationUnitbatchHandler.addObject( unitC );
-        
-        organisationUnitbatchHandler.flush();
-        
-        Collection<OrganisationUnit> units = organisationUnitService.getAllOrganisationUnits();
-        
-        assertTrue( units.contains( unitA ) );
-        assertTrue( units.contains( unitB ) );
-        assertTrue( units.contains( unitC ) );
-    }    
-
-    @Test
-    public void testInsertObject()
-    {
-        int idA = sourceBatchHandler.insertObject( unitA, true );
-        int idB = sourceBatchHandler.insertObject( unitB, true );
-        int idC = sourceBatchHandler.insertObject( unitC, true );
-        
-        unitA.setId( idA );
-        unitB.setId( idB );
-        unitC.setId( idC );
-        
-        organisationUnitbatchHandler.insertObject( unitA, true );
-        organisationUnitbatchHandler.insertObject( unitB, true );
-        organisationUnitbatchHandler.insertObject( unitC, true );
-        
-        assertNotNull( organisationUnitService.getOrganisationUnit( idA ) );
-        assertNotNull( organisationUnitService.getOrganisationUnit( idB ) );
-        assertNotNull( organisationUnitService.getOrganisationUnit( idC ) );
-    }    
-
-    @Test
-    public void testUpdateObject()
-    {
-        int id = sourceBatchHandler.insertObject( unitA, true );
-        
-        unitA.setId( id );
-        
-        organisationUnitbatchHandler.insertObject( unitA, false );
-        
-        unitA.setName( "UpdatedName" );
-        
-        organisationUnitbatchHandler.updateObject( unitA );
-        
-        assertEquals( "UpdatedName", organisationUnitService.getOrganisationUnit( id ).getName() );
-    }
-
-    @Test
-    public void testGetObjectIdentifier()
-    {
-        int referenceId = organisationUnitService.addOrganisationUnit( unitA );
-        
-        int retrievedId = organisationUnitbatchHandler.getObjectIdentifier( "OrganisationUnitA" );
-
-        assertEquals( referenceId, retrievedId );
-    }
-
-    @Test
-    public void testObjectExists()
-    {
-        organisationUnitService.addOrganisationUnit( unitA );
-        
-        assertTrue( organisationUnitbatchHandler.objectExists( unitA ) );
-        
-        assertFalse( organisationUnitbatchHandler.objectExists( unitB ) );
-    }
-}

=== modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/OrganisationUnitBatchHandler.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/OrganisationUnitBatchHandler.java	2010-11-23 16:12:57 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/OrganisationUnitBatchHandler.java	2011-04-22 21:04:14 +0000
@@ -44,7 +44,7 @@
 
     public OrganisationUnitBatchHandler( JdbcConfiguration config )
     {
-        super( config, true, false );
+        super( config, false, false );
     }
 
     // -------------------------------------------------------------------------
@@ -55,6 +55,12 @@
     {
         statementBuilder.setTableName( "organisationunit" );
     }
+
+    @Override
+    protected void setAutoIncrementColumn()
+    {
+        statementBuilder.setAutoIncrementColumn( "organisationunitid" );
+    }
     
     @Override
     protected void setIdentifierColumns()
@@ -84,7 +90,6 @@
     
     protected void setColumns()
     {
-        statementBuilder.setColumn( "organisationunitid" );
         statementBuilder.setColumn( "uuid" );
         statementBuilder.setColumn( "name" );
         statementBuilder.setColumn( "parentid" );
@@ -101,8 +106,7 @@
     }
     
     protected void setValues( OrganisationUnit unit )
-    {        
-        statementBuilder.setValue( unit.getId() );
+    {
         statementBuilder.setValue( unit.getUuid() );
         statementBuilder.setValue( unit.getName() );        
         statementBuilder.setValue( unit.getParent() != null ? unit.getParent().getId() : null );

=== removed file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/SourceBatchHandler.java'
--- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/SourceBatchHandler.java	2010-11-23 16:12:57 +0000
+++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/SourceBatchHandler.java	1970-01-01 00:00:00 +0000
@@ -1,84 +0,0 @@
-package org.hisp.dhis.jdbc.batchhandler;
-
-/*
- * Copyright (c) 2004-2010, 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 org.amplecode.quick.JdbcConfiguration;
-import org.amplecode.quick.batchhandler.AbstractBatchHandler;
-import org.hisp.dhis.source.Source;
-
-/**
- * @author Lars Helge Overland
- * @version $Id: SourceBatchHandler.java 5062 2008-05-01 18:10:35Z larshelg $
- */
-public class SourceBatchHandler
-    extends AbstractBatchHandler<Source>
-{
-    // -------------------------------------------------------------------------
-    // Constructor
-    // -------------------------------------------------------------------------
- 
-    public SourceBatchHandler( JdbcConfiguration config )
-    {
-        super( config, false, false );
-    }
-
-    // -------------------------------------------------------------------------
-    // AbstractBatchHandler implementation
-    // -------------------------------------------------------------------------
-
-    protected void setTableName()
-    {
-        statementBuilder.setTableName( "source" );
-    }
-
-    @Override
-    protected void setAutoIncrementColumn()
-    {
-        statementBuilder.setAutoIncrementColumn( "sourceid" );
-    }
-    
-    protected void setUniqueColumns()
-    {
-        statementBuilder.setUniqueColumn( "sourceid" );
-    }
-    
-    protected void setUniqueValues( Source source )
-    {
-        statementBuilder.setUniqueValue( source.getId() );
-    }
-    
-    protected void setColumns()
-    {
-        // Nothing to add
-    }
-    
-    protected void setValues( Source source )
-    {
-        // Nothing to add
-    }
-}

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DefaultDeletionManager.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DefaultDeletionManager.java	2011-02-22 23:17:50 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DefaultDeletionManager.java	2011-04-22 21:04:14 +0000
@@ -36,8 +36,6 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.hisp.dhis.common.DeleteNotAllowedException;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.source.Source;
 
 /**
  * @author Lars Helge Overland
@@ -71,11 +69,6 @@
     {
         Class<?> clazz = object.getClass();
 
-        if ( object instanceof OrganisationUnit )
-        {
-            clazz = Source.class; // Set class of Source implementations to Source
-        }
-
         String className = clazz.getSimpleName();
 
         // ---------------------------------------------------------------------

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java	2011-04-22 17:02:27 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java	2011-04-22 21:04:14 +0000
@@ -78,7 +78,6 @@
 import org.hisp.dhis.relationship.RelationshipType;
 import org.hisp.dhis.report.Report;
 import org.hisp.dhis.reporttable.ReportTable;
-import org.hisp.dhis.source.Source;
 import org.hisp.dhis.user.User;
 import org.hisp.dhis.user.UserAuthorityGroup;
 import org.hisp.dhis.user.UserCredentials;
@@ -300,15 +299,6 @@
         return true;
     }
 
-    public void deleteSource( Source source )
-    {
-    }
-
-    public boolean allowDeleteSource( Source source )
-    {
-        return true;
-    }
-
     public void deleteValidationRule( ValidationRule validationRule )
     {
     }

=== 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	2011-04-22 17:02:27 +0000
+++ dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java	2011-04-22 21:04:14 +0000
@@ -88,8 +88,6 @@
 import org.hisp.dhis.program.ProgramStage;
 import org.hisp.dhis.program.ProgramStageService;
 import org.hisp.dhis.resourcetable.ResourceTableService;
-import org.hisp.dhis.source.Source;
-import org.hisp.dhis.source.SourceStore;
 import org.hisp.dhis.sqlview.SqlView;
 import org.hisp.dhis.user.User;
 import org.hisp.dhis.user.UserGroup;
@@ -130,8 +128,6 @@
 
     protected CompleteDataSetRegistrationService completeDataSetRegistrationService;
 
-    protected SourceStore sourceStore;
-
     protected OrganisationUnitService organisationUnitService;
 
     protected OrganisationUnitGroupService organisationUnitGroupService;
@@ -689,7 +685,7 @@
      * @param value The value.
      * @param categoryOptionCombo The data element category option combo.
      */
-    public static DataValue createDataValue( DataElement dataElement, Period period, Source source, String value,
+    public static DataValue createDataValue( DataElement dataElement, Period period, OrganisationUnit source, String value,
         DataElementCategoryOptionCombo categoryOptionCombo )
     {
         DataValue dataValue = new DataValue();
@@ -714,7 +710,7 @@
      * @param lastupdated The date.
      * @param categoryOptionCombo The data element category option combo.
      */
-    public static DataValue createDataValue( DataElement dataElement, Period period, Source source, String value,
+    public static DataValue createDataValue( DataElement dataElement, Period period, OrganisationUnit source, String value,
         Date lastupdated, DataElementCategoryOptionCombo categoryOptionCombo )
     {
         DataValue dataValue = new DataValue();

=== removed file 'dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/mock/MockSource.java'
--- dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/mock/MockSource.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/mock/MockSource.java	1970-01-01 00:00:00 +0000
@@ -1,106 +0,0 @@
-package org.hisp.dhis.mock;
-
-import org.hisp.dhis.source.Source;
-
-/*
- * Copyright (c) 2004-2010, 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.
- */
-
-/**
- * @author Torgeir Lorange Ostby
- * @version $Id: DummySource.java 5424 2008-06-16 01:11:56Z larshelg $
- */
-public class MockSource
-    extends Source
-{
-    private String name;
-
-    // -------------------------------------------------------------------------
-    // Constructors
-    // -------------------------------------------------------------------------
-
-    public MockSource()
-    {
-    }
-
-    public MockSource( String name )
-    {
-        this.name = name;
-    }
-
-    // -------------------------------------------------------------------------
-    // hashCode and equals
-    // -------------------------------------------------------------------------
-
-    @Override
-    public int hashCode()
-    {
-        return name.hashCode();
-    }
-
-    @Override
-    public boolean equals( Object o )
-    {
-        if ( this == o )
-        {
-            return true;
-        }
-
-        if ( o == null )
-        {
-            return false;
-        }
-
-        if ( !(o instanceof MockSource) )
-        {
-            return false;
-        }
-
-        final MockSource other = (MockSource) o;
-
-        return name.equals( other.getName() );
-    }
-    
-    @Override
-    public String toString()
-    {
-        return "[" + name + "]";
-    }
-
-    // -------------------------------------------------------------------------
-    // Getters and setters
-    // -------------------------------------------------------------------------
-
-    public void setName( String name )
-    {
-        this.name = name;
-    }
-
-    public String getName()
-    {
-        return name;
-    }
-}

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/DataSetResource.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/DataSetResource.java	2011-02-25 18:08:38 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/resources/DataSetResource.java	2011-04-22 21:04:14 +0000
@@ -65,7 +65,7 @@
         t.append( "</p>\n" );
 
         t.append( "<h2>Org units reporting data set</h2>\n<ul>" );
-        for ( OrganisationUnit unit : dataSet.getOrganisationUnits() )
+        for ( OrganisationUnit unit : dataSet.getSources() )
         {
             t.append( "<li><b>" ).append( unit.getName() ).append( "</b> - " ).append( unit.getUuid() )
                 .append( "</li>" );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/GetDataSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/GetDataSetAction.java	2011-02-17 08:25:53 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/GetDataSetAction.java	2011-04-22 21:04:14 +0000
@@ -142,7 +142,7 @@
 
         dataEntryForm = dataSet.getDataEntryForm();        
         
-        selectionTreeManager.setSelectedOrganisationUnits( dataSet.getOrganisationUnits() );
+        selectionTreeManager.setSelectedOrganisationUnits( dataSet.getSources() );
         
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/GetValidationResultDetailsAction.java'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/GetValidationResultDetailsAction.java	2011-01-27 17:41:50 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/GetValidationResultDetailsAction.java	2011-04-22 21:04:14 +0000
@@ -38,10 +38,10 @@
 import org.hisp.dhis.datavalue.DataValue;
 import org.hisp.dhis.datavalue.DataValueService;
 import org.hisp.dhis.expression.ExpressionService;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
-import org.hisp.dhis.source.Source;
 import org.hisp.dhis.validation.ValidationRule;
 import org.hisp.dhis.validation.ValidationRuleService;
 
@@ -170,7 +170,7 @@
 
         Period period = periodService.getPeriod( periodId );
 
-        Source source = organisationUnitService.getOrganisationUnit( sourceId );
+        OrganisationUnit source = organisationUnitService.getOrganisationUnit( sourceId );
 
         for ( DataElementOperand operand : expressionService.getOperandsInExpression( validationRule.getLeftSide().getExpression() ) )
         {