dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #05788
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1826: Removed unused method
------------------------------------------------------------
revno: 1826
committer: Lars <larshelg@larshelg-laptop>
branch nick: trunk
timestamp: Thu 2010-05-06 18:05:43 +0200
message:
Removed unused method
modified:
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-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/HibernateDataValueStore.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueStoreTest.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/datavalue/DataValueService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueService.java 2010-04-28 15:14:05 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueService.java 2010-05-06 16:05:43 +0000
@@ -226,21 +226,6 @@
Collection<Period> periods, Collection<? extends Source> sources );
/**
- * Returns all DataValues for a given collection of DataElements, collection of Periods, and
- * collection of Sources, limited by a given start indexs and number of elements to return.
- *
- * @param dataElements the DataElements of the DataValue.
- * @param periods the Periods of the DataValue.
- * @param sources the Sources of the DataValues.
- * @param firstResult the zero-based index of the first DataValue in the collection to return.
- * @param maxResults the maximum number of DataValues to return. 0 means no restrictions.
- * @return a collection of all DataValues which match the given collection of DataElements,
- * Periods, and Sources, limited by the firstResult and maxResults property.
- */
- Collection<DataValue> getDataValues( Collection<DataElement> dataElements, Collection<Period> periods,
- Collection<? extends Source> sources, int firstResult, int maxResults );
-
- /**
* Returns all DataValues for a given collection of DataElementCategoryOptionCombos.
*
* @param optionCombos the DataElementCategoryOptionCombos of the DataValue.
=== 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 2010-04-28 15:14:05 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueStore.java 2010-05-06 16:05:43 +0000
@@ -218,21 +218,6 @@
Collection<Period> periods, Collection<? extends Source> sources );
/**
- * Returns all DataValues for a given collection of DataElements, collection of Periods, and
- * collection of Sources, limited by a given start indexs and number of elements to return.
- *
- * @param dataElements the DataElements of the DataValue.
- * @param periods the Periods of the DataValue.
- * @param sources the Sources of the DataValues.
- * @param firstResult the zero-based index of the first DataValue in the collection to return.
- * @param maxResults the maximum number of DataValues to return. 0 means no restrictions.
- * @return a collection of all DataValues which match the given collection of DataElements,
- * Periods, and Sources, limited by the firstResult and maxResults property.
- */
- Collection<DataValue> getDataValues( Collection<DataElement> dataElements, Collection<Period> periods,
- Collection<? extends Source> sources, int firstResult, int maxResults );
-
- /**
* Returns all DataValues for a given collection of DataElementCategoryOptionCombos.
*
* @param optionCombos the DataElementCategoryOptionCombos of the DataValue.
=== 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 2010-04-28 15:14:05 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueService.java 2010-05-06 16:05:43 +0000
@@ -200,12 +200,6 @@
return dataValueStore.getDataValues( dataElement, optionCombo, periods, sources );
}
- public Collection<DataValue> getDataValues( Collection<DataElement> dataElements, Collection<Period> periods,
- Collection<? extends Source> sources, int firstResult, int maxResults )
- {
- return dataValueStore.getDataValues( dataElements, periods, sources, firstResult, maxResults );
- }
-
public Collection<DataValue> getDataValues( Collection<DataElementCategoryOptionCombo> optionCombos )
{
return dataValueStore.getDataValues( optionCombos );
=== 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 2010-04-28 15:14:05 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueStore.java 2010-05-06 16:05:43 +0000
@@ -37,7 +37,6 @@
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
-import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
@@ -365,48 +364,6 @@
}
@SuppressWarnings( "unchecked" )
- public Collection<DataValue> getDataValues( Collection<DataElement> dataElements, Collection<Period> periods,
- Collection<? extends Source> sources, int firstResult, int maxResults )
- {
- Collection<Period> storedPeriods = new ArrayList<Period>();
-
- for ( Period period : periods )
- {
- Period storedPeriod = reloadPeriod( period );
-
- if ( storedPeriod != null )
- {
- storedPeriods.add( storedPeriod );
- }
- }
-
- if ( storedPeriods.size() == 0 )
- {
- return Collections.emptySet();
- }
-
- Session session = sessionFactory.getCurrentSession();
-
- Criteria criteria = session.createCriteria( DataValue.class );
-
- criteria.add( Restrictions.in( "dataElement", dataElements ) );
- criteria.add( Restrictions.in( "period", storedPeriods ) );
- criteria.add( Restrictions.in( "source", sources ) );
-
- if ( maxResults != 0 )
- {
- criteria.addOrder( Order.asc( "dataElement" ) );
- criteria.addOrder( Order.asc( "period" ) );
- criteria.addOrder( Order.asc( "source" ) );
-
- criteria.setFirstResult( firstResult );
- criteria.setMaxResults( maxResults );
- }
-
- return criteria.list();
- }
-
- @SuppressWarnings( "unchecked" )
public Collection<DataValue> getDataValues( Collection<DataElementCategoryOptionCombo> optionCombos )
{
Session session = sessionFactory.getCurrentSession();
@@ -428,7 +385,6 @@
return criteria.list();
}
-
@Override
public DataValue getLatestDataValues( DataElement dataElement, PeriodType periodType,
OrganisationUnit organisationUnit )
=== 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 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/datavalue/DataValueStoreTest.java 2010-05-06 16:05:43 +0000
@@ -599,66 +599,4 @@
assertTrue( dataValues.contains( dataValueA ) );
assertTrue( dataValues.contains( dataValueB ) );
}
-
- @Test
- public void testGetDataValuesDataElementsPeriodsSourcesFirstResultMaxResults()
- throws Exception
- {
- DataValue dataValueA = new DataValue( dataElementA, periodA, sourceA, optionCombo );
- dataValueA.setValue( "1" );
- DataValue dataValueB = new DataValue( dataElementA, periodB, sourceB, optionCombo );
- dataValueB.setValue( "2" );
- DataValue dataValueC = new DataValue( dataElementB, periodC, sourceC, optionCombo );
- dataValueC.setValue( "3" );
- DataValue dataValueD = new DataValue( dataElementB, periodD, sourceD, optionCombo );
- dataValueD.setValue( "4" );
- DataValue dataValueE = new DataValue( dataElementC, periodA, sourceA, optionCombo );
- dataValueC.setValue( "5" );
- DataValue dataValueF = new DataValue( dataElementC, periodB, sourceB, optionCombo );
- dataValueD.setValue( "6" );
- DataValue dataValueG = new DataValue( dataElementD, periodC, sourceC, optionCombo );
- dataValueC.setValue( "7" );
- DataValue dataValueH = new DataValue( dataElementD, periodD, sourceD, optionCombo );
- dataValueD.setValue( "8" );
-
- dataValueStore.addDataValue( dataValueA );
- dataValueStore.addDataValue( dataValueB );
- dataValueStore.addDataValue( dataValueC );
- dataValueStore.addDataValue( dataValueD );
- dataValueStore.addDataValue( dataValueE );
- dataValueStore.addDataValue( dataValueF );
- dataValueStore.addDataValue( dataValueG );
- dataValueStore.addDataValue( dataValueH );
-
- Collection<DataElement> dataElements = new HashSet<DataElement>();
- dataElements.add( dataElementA );
- dataElements.add( dataElementB );
- dataElements.add( dataElementC );
-
- Collection<Period> periods = new HashSet<Period>();
- periods.add( periodA );
- periods.add( periodB );
- periods.add( periodC );
-
- Collection<Source> sources = new HashSet<Source>();
- sources.add( sourceA );
- sources.add( sourceB );
- sources.add( sourceC );
-
- Collection<DataValue> dataValues = dataValueStore.getDataValues( dataElements, periods, sources, 0, 10 );
-
- assertEquals( dataValues.size(), 5 );
- assertTrue( dataValues.contains( dataValueA ) );
- assertTrue( dataValues.contains( dataValueB ) );
- assertTrue( dataValues.contains( dataValueC ) );
- assertTrue( dataValues.contains( dataValueE ) );
- assertTrue( dataValues.contains( dataValueF ) );
-
- dataValues = dataValueStore.getDataValues( dataElements, periods, sources, 1, 3 );
-
- assertEquals( dataValues.size(), 3 );
- assertTrue( dataValues.contains( dataValueB ) );
- assertTrue( dataValues.contains( dataValueC ) );
- assertTrue( dataValues.contains( dataValueE ) );
- }
}