dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #15985
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5926: Removed DataMartExport object and service
------------------------------------------------------------
revno: 5926
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2012-02-12 20:57:05 +0100
message:
Removed DataMartExport object and service
removed:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/datamart/DataMartExport.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/datamart/comparator/
dhis-2/dhis-api/src/main/java/org/hisp/dhis/datamart/comparator/DataMartExportComparator.java
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/DataMartInternalProcess.java
dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/org/
dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/org/hisp/
dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/org/hisp/dhis/
dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/org/hisp/dhis/datamart/
dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/org/hisp/dhis/datamart/hibernate/
dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/org/hisp/dhis/datamart/hibernate/DataMartExport.hbm.xml
dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartExportServiceTest.java
dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartExportStoreTest.java
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/datamart/DataMartService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/impl/DefaultDataMartService.java
dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.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
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/datamart/DataMartExport.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datamart/DataMartExport.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datamart/DataMartExport.java 1970-01-01 00:00:00 +0000
@@ -1,197 +0,0 @@
-package org.hisp.dhis.datamart;
-
-/*
- * Copyright (c) 2004-2012, 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.io.Serializable;
-import java.util.Collection;
-import java.util.HashSet;
-
-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.period.RelativePeriods;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class DataMartExport
- implements Serializable
-{
- /**
- * Determines if a de-serialized file is compatible with this class.
- */
- private static final long serialVersionUID = -4567670325185822423L;
-
- private int id;
-
- private String name;
-
- private Collection<DataElement> dataElements = new HashSet<DataElement>();
-
- private Collection<Indicator> indicators = new HashSet<Indicator>();
-
- private Collection<OrganisationUnit> organisationUnits = new HashSet<OrganisationUnit>();
-
- private Collection<Period> periods = new HashSet<Period>();
-
- private RelativePeriods relatives;
-
- // -------------------------------------------------------------------------
- // Constructors
- // -------------------------------------------------------------------------
-
- public DataMartExport()
- {
- }
-
- public DataMartExport( String name, Collection<DataElement> dataElements, Collection<Indicator> indicators,
- Collection<OrganisationUnit> organisationUnits, Collection<Period> periods, RelativePeriods relatives )
- {
- this.name = name;
- this.dataElements = dataElements;
- this.indicators = indicators;
- this.organisationUnits = organisationUnits;
- this.periods = periods;
- this.relatives = relatives;
- }
-
- // -------------------------------------------------------------------------
- // Getters & setters
- // -------------------------------------------------------------------------
-
- public int getId()
- {
- return id;
- }
-
- public void setId( int id )
- {
- this.id = id;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName( String name )
- {
- this.name = name;
- }
-
- public Collection<DataElement> getDataElements()
- {
- return dataElements;
- }
-
- public void setDataElements( Collection<DataElement> dataElements )
- {
- this.dataElements = dataElements;
- }
-
- public Collection<Indicator> getIndicators()
- {
- return indicators;
- }
-
- public void setIndicators( Collection<Indicator> indicators )
- {
- this.indicators = indicators;
- }
-
- public Collection<OrganisationUnit> getOrganisationUnits()
- {
- return organisationUnits;
- }
-
- public void setOrganisationUnits( Collection<OrganisationUnit> organisationUnits )
- {
- this.organisationUnits = organisationUnits;
- }
-
- public Collection<Period> getPeriods()
- {
- return periods;
- }
-
- public void setPeriods( Collection<Period> periods )
- {
- this.periods = periods;
- }
-
- public RelativePeriods getRelatives()
- {
- return relatives;
- }
-
- public void setRelatives( RelativePeriods relatives )
- {
- this.relatives = relatives;
- }
-
- // -------------------------------------------------------------------------
- // hashCode and equals
- // -------------------------------------------------------------------------
-
- @Override
- public int hashCode()
- {
- final int prime = 31;
-
- int result = 1;
-
- result = prime * result + ( ( name == null ) ? 0 : name.hashCode() );
-
- return result;
- }
-
- @Override
- public boolean equals( Object object )
- {
- if ( this == object )
- {
- return true;
- }
-
- if ( object == null )
- {
- return false;
- }
-
- if ( getClass() != object.getClass() )
- {
- return false;
- }
-
- final DataMartExport other = (DataMartExport) object;
-
- return name.equals( other.name );
- }
-}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/datamart/DataMartService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datamart/DataMartService.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datamart/DataMartService.java 2012-02-12 19:57:05 +0000
@@ -38,18 +38,6 @@
{
final String ID = DataMartService.class.getName();
- // ----------------------------------------------------------------------
- // Export
- // ----------------------------------------------------------------------
-
- /**
- * Export to data mart for the given DataMartExport.
- *
- * @id the DataMartExport identifier.
- * @return the number of exported values.
- */
- void export( int id );
-
/**
* Exports to data mart for the given arguments.
*
@@ -87,53 +75,4 @@
void export( Collection<Integer> dataElementIds, Collection<Integer> indicatorIds,
Collection<Integer> periodIds, Collection<Integer> organisationUnitIds, Collection<Integer> organisationUnitGroupIds,
RelativePeriods relatives, boolean completeExport );
-
- // ----------------------------------------------------------------------
- // DataMartExport
- // ----------------------------------------------------------------------
-
- /**
- * Saves a DataMartExport.
- *
- * @param export the DataMartExport to save.
- */
- void saveDataMartExport( DataMartExport export );
-
- /**
- * Retrieves the DataMartExport with the given identifier.
- *
- * @param id the identifier of the DataMartExport.
- * @return the DataMartExport.
- */
- DataMartExport getDataMartExport( int id );
-
- /**
- * Deletes a DataMartExport.
- *
- * @param export the DataMartExport to delete.
- */
- void deleteDataMartExport( DataMartExport export );
-
- /**
- * Retrieves all DataMartExports.
- *
- * @return a Collection of DataMartExports.
- */
- Collection<DataMartExport> getAllDataMartExports();
-
- /**
- * Retrieves the DataMartExport with the given name.
- *
- * @param name the name of the DataMartExport to retrieve.
- * @return the DataMartExport.
- */
- DataMartExport getDataMartExportByName( String name );
-
- Collection<DataMartExport> getDataMartExportsBetween( int first, int max );
-
- Collection<DataMartExport> getDataMartExportsBetweenByName( String name, int first, int max );
-
- int getDataMartExportCount();
-
- int getDataMartExportCountByName( String name );
}
=== removed directory 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/datamart/comparator'
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/datamart/comparator/DataMartExportComparator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datamart/comparator/DataMartExportComparator.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datamart/comparator/DataMartExportComparator.java 1970-01-01 00:00:00 +0000
@@ -1,45 +0,0 @@
-package org.hisp.dhis.datamart.comparator;
-
-/*
- * Copyright (c) 2004-2012, 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.Comparator;
-
-import org.hisp.dhis.datamart.DataMartExport;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class DataMartExportComparator
- implements Comparator<DataMartExport>
-{
- public int compare( DataMartExport export1, DataMartExport export2 )
- {
- return export1.getName().compareToIgnoreCase( export2.getName() );
- }
-}
=== 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 2012-02-01 12:16:49 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2012-02-12 19:57:05 +0000
@@ -91,7 +91,12 @@
executeSql( "DROP TABLE dashboardcontent_olapurls" );
executeSql( "DROP TABLE olapurl" );
executeSql( "DROP TABLE calculateddataelement" );
- executeSql( "DROP TABLE systemsequence" );
+ executeSql( "DROP TABLE systemsequence" );
+ executeSql( "DROP TABLE datamartexport" );
+ executeSql( "DROP TABLE datamartexportdataelements" );
+ executeSql( "DROP TABLE datamartexportindicators" );
+ executeSql( "DROP TABLE datamartexportorgunits" );
+ executeSql( "DROP TABLE datamartexportperiods" );
executeSql( "ALTER TABLE dataelementcategoryoption drop column categoryid" );
executeSql( "ALTER TABLE reporttable DROP column dimension_type" );
executeSql( "ALTER TABLE reporttable DROP column dimensiontype" );
@@ -301,18 +306,6 @@
executeSql( "ALTER TABLE chart DROP COLUMN individualmonthsthisyear" );
executeSql( "ALTER TABLE chart DROP COLUMN individualquartersthisyear" );
- executeSql( "ALTER TABLE datamartexport DROP COLUMN last3months" );
- executeSql( "ALTER TABLE datamartexport DROP COLUMN last6months" );
- executeSql( "ALTER TABLE datamartexport DROP COLUMN last9months" );
- executeSql( "ALTER TABLE datamartexport DROP COLUMN sofarthisyear" );
- executeSql( "ALTER TABLE datamartexport DROP COLUMN sofarthisfinancialyear" );
- executeSql( "ALTER TABLE datamartexport DROP COLUMN last3to6months" );
- executeSql( "ALTER TABLE datamartexport DROP COLUMN last6to9months" );
- executeSql( "ALTER TABLE datamartexport DROP COLUMN last9to12months" );
- executeSql( "ALTER TABLE datamartexport DROP COLUMN last12individualmonths" );
- executeSql( "ALTER TABLE datamartexport DROP COLUMN individualmonthsthisyear" );
- executeSql( "ALTER TABLE datamartexport DROP COLUMN individualquartersthisyear" );
-
// remove source
executeSql( "ALTER TABLE datasetsource DROP CONSTRAINT fk766ae2938fd8026a" );
=== removed 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 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/DataMartExportDeletionHandler.java 1970-01-01 00:00:00 +0000
@@ -1,111 +0,0 @@
-package org.hisp.dhis.datamart;
-
-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.system.deletion.DeletionHandler;
-
-/*
- * Copyright (c) 2004-2012, 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 Lars Helge Overland
- * @version $Id$
- */
-public class DataMartExportDeletionHandler
- extends DeletionHandler
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private DataMartService dataMartService;
-
- public void setDataMartService( DataMartService dataMartService )
- {
- this.dataMartService = dataMartService;
- }
-
- // -------------------------------------------------------------------------
- // DeletionHandler implementation
- // -------------------------------------------------------------------------
-
- @Override
- public String getClassName()
- {
- return DataMartExport.class.getSimpleName();
- }
-
- @Override
- public void deleteDataElement( DataElement dataElement )
- {
- for ( DataMartExport export : dataMartService.getAllDataMartExports() )
- {
- if ( export.getDataElements().remove( dataElement ) )
- {
- dataMartService.saveDataMartExport( export );
- }
- }
- }
-
- @Override
- public void deleteIndicator( Indicator indicator )
- {
- for ( DataMartExport export : dataMartService.getAllDataMartExports() )
- {
- if ( export.getIndicators().remove( indicator ) )
- {
- dataMartService.saveDataMartExport( export );
- }
- }
- }
-
- @Override
- public void deletePeriod( Period period )
- {
- for ( DataMartExport export : dataMartService.getAllDataMartExports() )
- {
- if ( export.getPeriods().remove( period ) )
- {
- dataMartService.saveDataMartExport( export );
- }
- }
- }
-
- @Override
- public void deleteOrganisationUnit( OrganisationUnit unit )
- {
- for ( DataMartExport export : dataMartService.getAllDataMartExports() )
- {
- if ( export.getOrganisationUnits().remove( unit ) )
- {
- dataMartService.saveDataMartExport( export );
- }
- }
- }
-}
=== removed file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/DataMartInternalProcess.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/DataMartInternalProcess.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/DataMartInternalProcess.java 1970-01-01 00:00:00 +0000
@@ -1,115 +0,0 @@
-package org.hisp.dhis.datamart;
-
-/*
- * Copyright (c) 2004-2012, 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 org.hisp.dhis.system.util.ConversionUtils.getIdentifiers;
-
-import java.util.Collection;
-
-import org.amplecode.cave.process.SerialToGroup;
-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.period.RelativePeriods;
-import org.hisp.dhis.system.process.AbstractStatementInternalProcess;
-
-/**
- * Either the identifier or the DataMartExport object must be set. The
- * identifier is given priority.
- *
- * @author Lars Helge Overland
- */
-public class DataMartInternalProcess
- extends AbstractStatementInternalProcess implements SerialToGroup
-{
- public static final String ID = "internal-process-DataMart";
- public static final String PROCESS_TYPE = "DataMart";
-
- private static final String PROCESS_GROUP = "DataMartProcessGroup";
-
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private DataMartService dataMartService;
-
- public void setDataMartService( DataMartService dataMartService )
- {
- this.dataMartService = dataMartService;
- }
-
- private Integer id;
-
- public void setId( Integer id )
- {
- this.id = id;
- }
-
- private Collection<Integer> dataElementIds;
- private Collection<Integer> indicatorIds;
- private Collection<Integer> periodIds;
- private Collection<Integer> organisationUnitIds;
- private RelativePeriods relatives;
-
- public void setExport( DataMartExport export )
- {
- this.dataElementIds = getIdentifiers( DataElement.class, export.getDataElements() );
- this.indicatorIds = getIdentifiers( Indicator.class, export.getIndicators() );
- this.periodIds = getIdentifiers( Period.class, export.getPeriods() );
- this.organisationUnitIds = getIdentifiers( OrganisationUnit.class, export.getOrganisationUnits() );
- this.relatives = export.getRelatives();
- }
-
- // -------------------------------------------------------------------------
- // SerialToGroup implementation
- // -------------------------------------------------------------------------
-
- public String getGroup()
- {
- return PROCESS_GROUP;
- }
-
- // -------------------------------------------------------------------------
- // AbstractStatementInternalProcess implementation
- // -------------------------------------------------------------------------
-
- @Override
- protected void executeStatements()
- throws Exception
- {
- if ( id != null )
- {
- dataMartService.export( id );
- }
- else
- {
- dataMartService.export( dataElementIds, indicatorIds, periodIds, organisationUnitIds, relatives );
- }
- }
-}
=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/impl/DefaultDataMartService.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/impl/DefaultDataMartService.java 2012-02-12 13:16:57 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/impl/DefaultDataMartService.java 2012-02-12 19:57:05 +0000
@@ -30,19 +30,12 @@
import static org.hisp.dhis.system.util.ConversionUtils.getIdentifiers;
import java.util.Collection;
-import java.util.HashSet;
-import org.hisp.dhis.common.GenericIdentifiableObjectStore;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.datamart.DataMartExport;
import org.hisp.dhis.datamart.DataMartService;
import org.hisp.dhis.datamart.engine.DataMartEngine;
-import org.hisp.dhis.indicator.Indicator;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodService;
import org.hisp.dhis.period.RelativePeriods;
-import org.springframework.transaction.annotation.Transactional;
/**
* @author Lars Helge Overland
@@ -60,13 +53,6 @@
{
this.dataMartEngine = dataMartEngine;
}
-
- private GenericIdentifiableObjectStore<DataMartExport> dataMartExportStore;
-
- public void setDataMartExportStore( GenericIdentifiableObjectStore<DataMartExport> dataMartExportStore )
- {
- this.dataMartExportStore = dataMartExportStore;
- }
private PeriodService periodService;
@@ -78,27 +64,6 @@
// -------------------------------------------------------------------------
// Export
// -------------------------------------------------------------------------
-
- @Transactional //TODO potential problem with reload periods inside same tx
- public void export( int id )
- {
- DataMartExport dataMartExport = getDataMartExport( id );
-
- Collection<Period> allPeriods = new HashSet<Period>( dataMartExport.getPeriods() );
-
- if ( dataMartExport.getRelatives() != null )
- {
- allPeriods.addAll( periodService.reloadPeriods( dataMartExport.getRelatives().getRelativePeriods() ) );
- }
-
- dataMartEngine.export(
- getIdentifiers( DataElement.class, dataMartExport.getDataElements() ),
- getIdentifiers( Indicator.class, dataMartExport.getIndicators() ),
- getIdentifiers( Period.class, allPeriods ),
- getIdentifiers( OrganisationUnit.class, dataMartExport.getOrganisationUnits() ),
- null, false );
- }
-
public void export( Collection<Integer> dataElementIds, Collection<Integer> indicatorIds,
Collection<Integer> periodIds, Collection<Integer> organisationUnitIds )
@@ -123,62 +88,4 @@
dataMartEngine.export( dataElementIds, indicatorIds, periodIds, organisationUnitIds, organisationUnitGroupIds, completeExport );
}
-
- // -------------------------------------------------------------------------
- // DataMartExport
- // -------------------------------------------------------------------------
-
- @Transactional
- public void saveDataMartExport( DataMartExport export )
- {
- dataMartExportStore.save( export );
- }
-
- @Transactional
- public void deleteDataMartExport( DataMartExport export )
- {
- dataMartExportStore.delete( export );
- }
-
- @Transactional
- public DataMartExport getDataMartExport( int id )
- {
- return dataMartExportStore.get( id );
- }
-
- @Transactional
- public Collection<DataMartExport> getAllDataMartExports()
- {
- return dataMartExportStore.getAll();
- }
-
- @Transactional
- public DataMartExport getDataMartExportByName( String name )
- {
- return dataMartExportStore.getByName( name );
- }
-
- @Transactional
- public int getDataMartExportCount()
- {
- return dataMartExportStore.getCount();
- }
-
- @Transactional
- public int getDataMartExportCountByName( String name )
- {
- return dataMartExportStore.getCountByName( name );
- }
-
- @Transactional
- public Collection<DataMartExport> getDataMartExportsBetween( int first, int max )
- {
- return dataMartExportStore.getBetween( first, max );
- }
-
- @Transactional
- public Collection<DataMartExport> getDataMartExportsBetweenByName( String name, int first, int max )
- {
- return dataMartExportStore.getBetweenByName( name, first, max );
- }
}
=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/META-INF/dhis/beans.xml 2012-02-12 13:16:57 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/META-INF/dhis/beans.xml 2012-02-12 19:57:05 +0000
@@ -5,18 +5,10 @@
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd">
- <!-- DataMartExportStore -->
-
- <bean id="org.hisp.dhis.datamart.DataMartExportStore" class="org.hisp.dhis.hibernate.HibernateGenericStore">
- <property name="clazz" value="org.hisp.dhis.datamart.DataMartExport" />
- <property name="sessionFactory" ref="sessionFactory" />
- </bean>
-
<!-- DataMartService -->
<bean id="org.hisp.dhis.datamart.DataMartService" class="org.hisp.dhis.datamart.impl.DefaultDataMartService">
<property name="dataMartEngine" ref="org.hisp.dhis.datamart.engine.DataMartEngine" />
- <property name="dataMartExportStore" ref="org.hisp.dhis.datamart.DataMartExportStore" />
<property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
</bean>
@@ -38,12 +30,6 @@
<property name="systemSettingManager" ref="org.hisp.dhis.setting.SystemSettingManager" />
<property name="notifier" ref="notifier" />
</bean>
-
- <bean id="internal-process-DataMart" class="org.hisp.dhis.datamart.DataMartInternalProcess" scope="prototype">
- <property name="statementManager" ref="statementManager" />
- <property name="inMemoryStatementManager" ref="inMemoryStatementManager" />
- <property name="dataMartService" ref="org.hisp.dhis.datamart.DataMartService" />
- </bean>
<!-- Crosstab -->
@@ -118,36 +104,11 @@
<property name="batchHandlerFactory" ref="batchHandlerFactory" />
<property name="statementManager" ref="inMemoryStatementManager" />
</bean>
-
- <!-- DeletionHandler -->
-
- <bean id="org.hisp.dhis.datamart.DataMartExportDeletionHandler" class="org.hisp.dhis.datamart.DataMartExportDeletionHandler">
- <property name="dataMartService" ref="org.hisp.dhis.datamart.DataMartService" />
- </bean>
-
- <!-- DeletionManager -->
-
- <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
- <property name="targetObject" ref="deletionManager" />
- <property name="targetMethod" value="addDeletionHandlers" />
- <property name="arguments">
- <list>
- <list>
- <ref local="org.hisp.dhis.datamart.DataMartExportDeletionHandler" />
- </list>
- </list>
- </property>
- </bean>
-
+
<!-- Deletion AOP definitions -->
<aop:config>
- <aop:aspect ref="deletionInterceptor">
- <aop:before pointcut="execution( * org.hisp.dhis.datamart.DataMartService.deleteDataMartExport(..) )"
- method="intercept" />
- </aop:aspect>
-
<aop:aspect ref="inMemoryStatementInterceptor">
<aop:around pointcut="execution( * org.hisp.dhis.datamart.DataMartService.export(..) )" method="intercept" />
</aop:aspect>
=== removed directory 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/org'
=== removed directory 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/org/hisp'
=== removed directory 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/org/hisp/dhis'
=== removed directory 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/org/hisp/dhis/datamart'
=== removed directory 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/org/hisp/dhis/datamart/hibernate'
=== removed file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/org/hisp/dhis/datamart/hibernate/DataMartExport.hbm.xml'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/org/hisp/dhis/datamart/hibernate/DataMartExport.hbm.xml 2011-05-28 21:25:46 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/resources/org/hisp/dhis/datamart/hibernate/DataMartExport.hbm.xml 1970-01-01 00:00:00 +0000
@@ -1,46 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping>
- <class name="org.hisp.dhis.datamart.DataMartExport" table="datamartexport">
-
- <id name="id" column="datamartexportid">
- <generator class="native" />
- </id>
-
- <property name="name" column="name" unique="true" not-null="true" />
-
- <set name="dataElements" table="datamartexportdataelements">
- <key column="datamartexportid" foreign-key="fk_datamartexportdataelements_datamartexportid" />
- <many-to-many class="org.hisp.dhis.dataelement.DataElement" column="dataelementid" foreign-key="fk_datamartexportdataelements_dataelementid" />
- </set>
-
- <set name="indicators" table="datamartexportindicators">
- <key column="datamartexportid" foreign-key="fk_datamartexportindicators_datamartexportid" />
- <many-to-many class="org.hisp.dhis.indicator.Indicator" column="indicatorid" foreign-key="fk_datamartexportindicators_indicatorid" />
- </set>
-
- <set name="organisationUnits" table="datamartexportorgunits">
- <key column="datamartexportid" foreign-key="fk_datamartexportorgunits_datamartexportid" />
- <many-to-many class="org.hisp.dhis.organisationunit.OrganisationUnit" column="orgunitid" foreign-key="fk_datamartexportorgunits_organisationunitid" />
- </set>
-
- <set name="periods" table="datamartexportperiods">
- <key column="datamartexportid" foreign-key="fk_datamartexportperiods_datamartexportid" />
- <many-to-many class="org.hisp.dhis.period.Period" column="periodid" foreign-key="fk_datamartexportperiods_periodid" />
- </set>
-
- <component name="relatives">
- <property name="reportingMonth" />
- <property name="monthsThisYear" />
- <property name="quartersThisYear" />
- <property name="thisYear" />
- <property name="monthsLastYear" />
- <property name="quartersLastYear" />
- <property name="lastYear" />
- </component>
-
- </class>
-</hibernate-mapping>
=== removed file 'dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartExportServiceTest.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartExportServiceTest.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartExportServiceTest.java 1970-01-01 00:00:00 +0000
@@ -1,212 +0,0 @@
-package org.hisp.dhis.datamart;
-
-/*
- * Copyright (c) 2004-2012, 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 java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.hisp.dhis.DhisSpringTest;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.indicator.Indicator;
-import org.hisp.dhis.indicator.IndicatorService;
-import org.hisp.dhis.indicator.IndicatorType;
-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.junit.Test;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class DataMartExportServiceTest
- extends DhisSpringTest
-{
- private DataMartService dataMartService;
-
- private DataMartExport exportA;
- private DataMartExport exportB;
- private DataMartExport exportC;
-
- private Set<DataElement> dataElements;
- private Set<Indicator> indicators;
- private Set<OrganisationUnit> organisationUnits;
- private Set<Period> periods;
-
- // -------------------------------------------------------------------------
- // Fixture
- // -------------------------------------------------------------------------
-
- @Override
- public void setUpTest()
- {
- dataMartService = (DataMartService) getBean( DataMartService.ID );
-
- dataElementService = (DataElementService) getBean( DataElementService.ID );
-
- indicatorService = (IndicatorService) getBean( IndicatorService.ID );
-
- organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
-
- periodService = (PeriodService) getBean( PeriodService.ID );
-
- dataElements = new HashSet<DataElement>();
- indicators = new HashSet<Indicator>();
- organisationUnits = new HashSet<OrganisationUnit>();
- periods = new HashSet<Period>();
-
- DataElement dataElementA = createDataElement( 'A' );
- DataElement dataElementB = createDataElement( 'B' );
-
- dataElementService.addDataElement( dataElementA );
- dataElementService.addDataElement( dataElementB );
-
- dataElements.add( dataElementA );
- dataElements.add( dataElementB );
-
- IndicatorType indicatorType = createIndicatorType( 'A' );
-
- indicatorService.addIndicatorType( indicatorType );
-
- Indicator indicatorA = createIndicator( 'A', indicatorType );
- Indicator indicatorB = createIndicator( 'B', indicatorType );
-
- indicatorService.addIndicator( indicatorA );
- indicatorService.addIndicator( indicatorB );
-
- indicators.add( indicatorA );
- indicators.add( indicatorA );
-
- OrganisationUnit unitA = createOrganisationUnit( 'A' );
- OrganisationUnit unitB = createOrganisationUnit( 'B' );
-
- organisationUnitService.addOrganisationUnit( unitA );
- organisationUnitService.addOrganisationUnit( unitB );
-
- organisationUnits.add( unitA );
- organisationUnits.add( unitB );
-
- Period periodA = createPeriod( new MonthlyPeriodType(), getDate( 2000, 1, 1 ), getDate( 2000, 31, 1 ) );
- Period periodB = createPeriod( new MonthlyPeriodType(), getDate( 2000, 2, 1 ), getDate( 2000, 28, 2 ) );
-
- periodService.addPeriod( periodA );
- periodService.addPeriod( periodB );
-
- periods.add( periodA );
- periods.add( periodB );
-
- exportA = new DataMartExport( "ExportA", dataElements, indicators, organisationUnits, periods, null );
- exportB = new DataMartExport( "ExportB", dataElements, indicators, organisationUnits, periods, null );
- exportC = new DataMartExport( "ExportC", dataElements, indicators, organisationUnits, periods, null );
- }
-
- // -------------------------------------------------------------------------
- // Tests
- // -------------------------------------------------------------------------
-
- @Test
- public void testSaveGet()
- {
- dataMartService.saveDataMartExport( exportA );
- dataMartService.saveDataMartExport( exportB );
- dataMartService.saveDataMartExport( exportC );
-
- assertEquals( exportA, dataMartService.getDataMartExport( exportA.getId() ) );
- assertEquals( exportB, dataMartService.getDataMartExport( exportB.getId() ) );
- assertEquals( exportC, dataMartService.getDataMartExport( exportC.getId() ) );
-
- DataMartExport export = dataMartService.getDataMartExport( exportA.getId() );
-
- assertEquals( dataElements, export.getDataElements() );
- assertEquals( indicators, export.getIndicators() );
- assertEquals( organisationUnits, export.getOrganisationUnits() );
- assertEquals( periods, export.getPeriods() );
- }
-
- @Test
- public void testDelete()
- {
- dataMartService.saveDataMartExport( exportA );
- dataMartService.saveDataMartExport( exportB );
- dataMartService.saveDataMartExport( exportC );
-
- assertNotNull( dataMartService.getDataMartExport( exportA.getId() ) );
- assertNotNull( dataMartService.getDataMartExport( exportB.getId() ) );
- assertNotNull( dataMartService.getDataMartExport( exportC.getId() ) );
-
- dataMartService.deleteDataMartExport( exportA );
-
- assertNull( dataMartService.getDataMartExport( exportA.getId() ) );
- assertNotNull( dataMartService.getDataMartExport( exportB.getId() ) );
- assertNotNull( dataMartService.getDataMartExport( exportC.getId() ) );
-
- dataMartService.deleteDataMartExport( exportB );
-
- assertNull( dataMartService.getDataMartExport( exportA.getId() ) );
- assertNull( dataMartService.getDataMartExport( exportB.getId() ) );
- assertNotNull( dataMartService.getDataMartExport( exportC.getId() ) );
- }
-
- @Test
- public void testGetAll()
- {
- dataMartService.saveDataMartExport( exportA );
- dataMartService.saveDataMartExport( exportB );
- dataMartService.saveDataMartExport( exportC );
-
- Collection<DataMartExport> expected = new ArrayList<DataMartExport>();
- expected.add( exportA );
- expected.add( exportB );
- expected.add( exportC );
-
- Collection<DataMartExport> actual = dataMartService.getAllDataMartExports();
-
- assertEquals( expected, actual );
- }
-
- @Test
- public void testGetByName()
- {
- dataMartService.saveDataMartExport( exportA );
- dataMartService.saveDataMartExport( exportB );
- dataMartService.saveDataMartExport( exportC );
-
- DataMartExport actualA = dataMartService.getDataMartExportByName( exportA.getName() );
-
- assertEquals( exportA, actualA );
- }
-}
=== removed file 'dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartExportStoreTest.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartExportStoreTest.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/test/java/org/hisp/dhis/datamart/DataMartExportStoreTest.java 1970-01-01 00:00:00 +0000
@@ -1,220 +0,0 @@
-package org.hisp.dhis.datamart;
-
-/*
- * Copyright (c) 2004-2012, 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 java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.hisp.dhis.DhisSpringTest;
-import org.hisp.dhis.common.GenericIdentifiableObjectStore;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.indicator.Indicator;
-import org.hisp.dhis.indicator.IndicatorService;
-import org.hisp.dhis.indicator.IndicatorType;
-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.RelativePeriods;
-import org.junit.Test;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-@SuppressWarnings( "unchecked" )
-public class DataMartExportStoreTest
- extends DhisSpringTest
-{
- private GenericIdentifiableObjectStore<DataMartExport> dataMartExportStore;
-
- private DataMartExport exportA;
- private DataMartExport exportB;
- private DataMartExport exportC;
-
- private RelativePeriods relatives;
-
- private Set<DataElement> dataElements;
- private Set<Indicator> indicators;
- private Set<OrganisationUnit> organisationUnits;
- private Set<Period> periods;
-
- // -------------------------------------------------------------------------
- // Fixture
- // -------------------------------------------------------------------------
-
- @Override
- public void setUpTest()
- {
- dataMartExportStore = (GenericIdentifiableObjectStore<DataMartExport>) getBean( "org.hisp.dhis.datamart.DataMartExportStore" );
-
- dataElementService = (DataElementService) getBean( DataElementService.ID );
-
- indicatorService = (IndicatorService) getBean( IndicatorService.ID );
-
- organisationUnitService = (OrganisationUnitService) getBean( OrganisationUnitService.ID );
-
- periodService = (PeriodService) getBean( PeriodService.ID );
-
- dataElements = new HashSet<DataElement>();
- indicators = new HashSet<Indicator>();
- organisationUnits = new HashSet<OrganisationUnit>();
- periods = new HashSet<Period>();
-
- DataElement dataElementA = createDataElement( 'A' );
- DataElement dataElementB = createDataElement( 'B' );
-
- dataElementService.addDataElement( dataElementA );
- dataElementService.addDataElement( dataElementB );
-
- dataElements.add( dataElementA );
- dataElements.add( dataElementB );
-
- IndicatorType indicatorType = createIndicatorType( 'A' );
-
- indicatorService.addIndicatorType( indicatorType );
-
- Indicator indicatorA = createIndicator( 'A', indicatorType );
- Indicator indicatorB = createIndicator( 'B', indicatorType );
-
- indicatorService.addIndicator( indicatorA );
- indicatorService.addIndicator( indicatorB );
-
- indicators.add( indicatorA );
- indicators.add( indicatorA );
-
- OrganisationUnit unitA = createOrganisationUnit( 'A' );
- OrganisationUnit unitB = createOrganisationUnit( 'B' );
-
- organisationUnitService.addOrganisationUnit( unitA );
- organisationUnitService.addOrganisationUnit( unitB );
-
- organisationUnits.add( unitA );
- organisationUnits.add( unitB );
-
- Period periodA = createPeriod( new MonthlyPeriodType(), getDate( 2000, 1, 1 ), getDate( 2000, 31, 1 ) );
- Period periodB = createPeriod( new MonthlyPeriodType(), getDate( 2000, 2, 1 ), getDate( 2000, 28, 2 ) );
-
- periodService.addPeriod( periodA );
- periodService.addPeriod( periodB );
-
- periods.add( periodA );
- periods.add( periodB );
-
- relatives = new RelativePeriods( true, true, true, true, true, true, true, false, false, false, false, false, false, false, false );
-
- exportA = new DataMartExport( "ExportA", dataElements, indicators, organisationUnits, periods, relatives );
- exportB = new DataMartExport( "ExportB", dataElements, indicators, organisationUnits, periods, relatives );
- exportC = new DataMartExport( "ExportC", dataElements, indicators, organisationUnits, periods, relatives );
- }
-
- // -------------------------------------------------------------------------
- // Tests
- // -------------------------------------------------------------------------
-
- @Test
- public void testSaveGet()
- {
- dataMartExportStore.save( exportA );
- dataMartExportStore.save( exportB );
- dataMartExportStore.save( exportC );
-
- assertEquals( exportA, dataMartExportStore.get( exportA.getId() ) );
- assertEquals( exportB, dataMartExportStore.get( exportB.getId() ) );
- assertEquals( exportC, dataMartExportStore.get( exportC.getId() ) );
-
- DataMartExport export = dataMartExportStore.get( exportA.getId() );
-
- assertEquals( dataElements, export.getDataElements() );
- assertEquals( indicators, export.getIndicators() );
- assertEquals( organisationUnits, export.getOrganisationUnits() );
- assertEquals( periods, export.getPeriods() );
- assertEquals( relatives, export.getRelatives() );
- }
-
- @Test
- public void testDelete()
- {
- dataMartExportStore.save( exportA );
- dataMartExportStore.save( exportB );
- dataMartExportStore.save( exportC );
-
- assertNotNull( dataMartExportStore.get( exportA.getId() ) );
- assertNotNull( dataMartExportStore.get( exportB.getId() ) );
- assertNotNull( dataMartExportStore.get( exportC.getId() ) );
-
- dataMartExportStore.delete( exportA );
-
- assertNull( dataMartExportStore.get( exportA.getId() ) );
- assertNotNull( dataMartExportStore.get( exportB.getId() ) );
- assertNotNull( dataMartExportStore.get( exportC.getId() ) );
-
- dataMartExportStore.delete( exportB );
-
- assertNull( dataMartExportStore.get( exportA.getId() ) );
- assertNull( dataMartExportStore.get( exportB.getId() ) );
- assertNotNull( dataMartExportStore.get( exportC.getId() ) );
- }
-
- @Test
- public void testGetAll()
- {
- dataMartExportStore.save( exportA );
- dataMartExportStore.save( exportB );
- dataMartExportStore.save( exportC );
-
- Collection<DataMartExport> expected = new ArrayList<DataMartExport>();
- expected.add( exportA );
- expected.add( exportB );
- expected.add( exportC );
-
- Collection<DataMartExport> actual = dataMartExportStore.getAll();
-
- assertEquals( expected, actual );
- }
-
- @Test
- public void testGetByName()
- {
- dataMartExportStore.save( exportA );
- dataMartExportStore.save( exportB );
- dataMartExportStore.save( exportC );
-
- DataMartExport actualA = dataMartExportStore.getByName( exportA.getName() );
-
- assertEquals( exportA, actualA );
- }
-}
=== 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 2012-02-08 12:16:23 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/deletion/DeletionHandler.java 2012-02-12 19:57:05 +0000
@@ -32,9 +32,14 @@
import org.hisp.dhis.concept.Concept;
import org.hisp.dhis.constant.Constant;
import org.hisp.dhis.datadictionary.DataDictionary;
-import org.hisp.dhis.dataelement.*;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategory;
+import org.hisp.dhis.dataelement.DataElementCategoryCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryOption;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementGroup;
+import org.hisp.dhis.dataelement.DataElementGroupSet;
import org.hisp.dhis.dataentryform.DataEntryForm;
-import org.hisp.dhis.datamart.DataMartExport;
import org.hisp.dhis.dataset.CompleteDataSetRegistration;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.LockException;
@@ -56,17 +61,30 @@
import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
-import org.hisp.dhis.patient.*;
+import org.hisp.dhis.patient.Patient;
+import org.hisp.dhis.patient.PatientAttribute;
+import org.hisp.dhis.patient.PatientAttributeGroup;
+import org.hisp.dhis.patient.PatientIdentifier;
+import org.hisp.dhis.patient.PatientIdentifierType;
import org.hisp.dhis.patientattributevalue.PatientAttributeValue;
import org.hisp.dhis.patientdatavalue.PatientDataValue;
import org.hisp.dhis.period.Period;
-import org.hisp.dhis.program.*;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramInstance;
+import org.hisp.dhis.program.ProgramStage;
+import org.hisp.dhis.program.ProgramStageDataElement;
+import org.hisp.dhis.program.ProgramStageInstance;
+import org.hisp.dhis.program.ProgramValidation;
import org.hisp.dhis.programattributevalue.ProgramAttributeValue;
import org.hisp.dhis.relationship.Relationship;
import org.hisp.dhis.relationship.RelationshipType;
import org.hisp.dhis.report.Report;
import org.hisp.dhis.reporttable.ReportTable;
-import org.hisp.dhis.user.*;
+import org.hisp.dhis.user.User;
+import org.hisp.dhis.user.UserAuthorityGroup;
+import org.hisp.dhis.user.UserCredentials;
+import org.hisp.dhis.user.UserGroup;
+import org.hisp.dhis.user.UserSetting;
import org.hisp.dhis.validation.ValidationCriteria;
import org.hisp.dhis.validation.ValidationRule;
import org.hisp.dhis.validation.ValidationRuleGroup;
@@ -403,15 +421,6 @@
return null;
}
- public void deleteDataMartExport( DataMartExport dataMartExport )
- {
- }
-
- public String allowDeleteDataMartExport( DataMartExport dataMartExport )
- {
- return null;
- }
-
public void deleteDocument( Document document )
{
}