dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #02089
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 707: Removed check for reload of DataSet in DataSetLockStore.
------------------------------------------------------------
revno: 707
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Mon 2009-09-14 19:19:29 +0200
message:
Removed check for reload of DataSet in DataSetLockStore.
modified:
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/resources/META-INF/dhis/beans.xml
--
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-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 2009-09-14 16:00:37 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/datalock/hibernate/HibernateDataSetLockStore.java 2009-09-14 17:19:29 +0000
@@ -35,7 +35,6 @@
import org.hisp.dhis.datalock.DataSetLock;
import org.hisp.dhis.datalock.DataSetLockStore;
import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.dataset.DataSetService;
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodService;
import org.hisp.dhis.source.Source;
@@ -65,13 +64,6 @@
this.periodService = periodService;
}
- private DataSetService dataSetService;
-
- public void setDataSetService( DataSetService dataSetService )
- {
- this.dataSetService = dataSetService;
- }
-
// -------------------------------------------------------------------------
// Support methods for reloading periods
// -------------------------------------------------------------------------
@@ -102,32 +94,6 @@
return storedPeriod;
}
- private final DataSet reloadDataSet( DataSet dataSet )
- {
- Session session = sessionFactory.getCurrentSession();
-
- if ( session.contains( dataSet ) )
- {
- return dataSet; // Already in session, no reload needed
- }
-
- return dataSetService.getDataSet( dataSet.getId() );
- }
-
- private final DataSet reloadDataSetForceAdd( DataSet dataSet )
- {
- DataSet storedDataSet = reloadDataSet( dataSet );
-
- if ( storedDataSet == null )
- {
- dataSetService.addDataSet( storedDataSet );
-
- return dataSet;
- }
-
- return storedDataSet;
- }
-
// -------------------------------------------------------------------------
// DataSetLock
// -------------------------------------------------------------------------
@@ -135,7 +101,6 @@
public int addDataSetLock( DataSetLock dataSetLock )
{
dataSetLock.setPeriod( reloadPeriodForceAdd( dataSetLock.getPeriod() ) );
- dataSetLock.setDataSet( reloadDataSetForceAdd( dataSetLock.getDataSet() ) );
Session session = sessionFactory.getCurrentSession();
@@ -145,7 +110,6 @@
public void updateDataSetLock( DataSetLock dataSetLock )
{
dataSetLock.setPeriod( reloadPeriodForceAdd( dataSetLock.getPeriod() ) );
- dataSetLock.setDataSet( reloadDataSetForceAdd( dataSetLock.getDataSet() ) );
Session session = sessionFactory.getCurrentSession();
@@ -206,15 +170,14 @@
Session session = sessionFactory.getCurrentSession();
Period storedPeriod = reloadPeriod( period );
- DataSet storedDataSet = reloadDataSet( dataSet );
- if ( (storedPeriod == null) || (storedDataSet == null) )
+ if ( storedPeriod == null )
{
return null;
}
Criteria criteria = session.createCriteria( DataSetLock.class );
- criteria.add( Restrictions.eq( "dataSet", storedDataSet ) );
+ criteria.add( Restrictions.eq( "dataSet", dataSet ) );
criteria.add( Restrictions.eq( "period", storedPeriod ) );
return (DataSetLock) criteria.uniqueResult();
@@ -225,15 +188,14 @@
Session session = sessionFactory.getCurrentSession();
Period storedPeriod = reloadPeriod( period );
- DataSet storedDataSet = reloadDataSet( dataSet );
- if ( (storedPeriod == null) || (storedDataSet == null) )
+ if ( storedPeriod == null )
{
return null;
}
Criteria criteria = session.createCriteria( DataSetLock.class );
- criteria.add( Restrictions.eq( "dataSet", storedDataSet ) );
+ criteria.add( Restrictions.eq( "dataSet", dataSet ) );
criteria.add( Restrictions.eq( "period", storedPeriod ) );
criteria.createAlias( "sources", "s" );
criteria.add( Restrictions.eq( "s.id", source.getId() ) );
=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-administration/src/main/resources/META-INF/dhis/beans.xml 2009-09-14 16:07:07 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/resources/META-INF/dhis/beans.xml 2009-09-14 17:19:29 +0000
@@ -11,8 +11,6 @@
<property name="sessionFactory" ref="sessionFactory"/>
<property name="periodService"
ref="org.hisp.dhis.period.PeriodService"/>
- <property name="dataSetService"
- ref="org.hisp.dhis.dataset.DataSetService"/>
</bean>
<bean id="org.hisp.dhis.datalock.DataSetLockService"