← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4708: Removed code for managing data set mobile version on categories/options. We need to manage this s...

 

------------------------------------------------------------
revno: 4708
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-09-27 12:12:47 +0200
message:
  Removed code for managing data set mobile version on categories/options. We need to manage this somehow but this solution is too ugly.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSetService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSetStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/hibernate/HibernateDataSetStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/GetDataElementCategoryAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateDataElementCategoryAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateDataElementCategoryOptionAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/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-api/src/main/java/org/hisp/dhis/dataset/DataSetService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSetService.java	2011-05-30 19:32:17 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSetService.java	2011-09-27 10:12:47 +0000
@@ -207,20 +207,6 @@
      */
     Collection<DataSet> getDataSetsForMobile();
     
-    /**
-     * Get list of realted datasets from categoryOption
-     * 
-     * @return A List containing related DataSets.
-     */
-    Collection<DataSet> getMobileDataSetsFromCategoryOption(int categoryOptionId);
-    
-    /**
-     * Get list of realted datasets from category
-     * 
-     * @return A List containing related DataSets.
-     */
-    Collection<DataSet> getMobileDataSetsFromCategory(int categoryOptionId);
-    
     int getDataSetCountByName( String name );
     
     Collection<DataSet> getDataSetsBetweenByName( String name, int first, int max );

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSetStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSetStore.java	2011-04-22 17:02:27 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/DataSetStore.java	2011-09-27 10:12:47 +0000
@@ -131,10 +131,6 @@
 
     Collection<DataSet> getDataSetsBySources( Collection<OrganisationUnit> sources );
     
-    Collection<DataSet> getMobileDataSetsFromCategoryOption(int categoryOptionId);
-    
-    Collection<DataSet> getMobileDataSetsFromCategory(int categoryId);
-    
     int getDataSetCountByName( String name );
     
     Collection<DataSet> getDataSetsBetweenByName( String name, int first, int max );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java	2011-05-28 21:53:18 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java	2011-09-27 10:12:47 +0000
@@ -288,20 +288,11 @@
         return i18n( i18nService, dataSetStore.getDataSetsForMobile(source) );		
     }
     
-    public Collection<DataSet> getDataSetsForMobile(){
+    public Collection<DataSet> getDataSetsForMobile()
+    {
         return i18n( i18nService, dataSetStore.getDataSetsForMobile() );
     }
 
-    public Collection<DataSet> getMobileDataSetsFromCategoryOption( int categoryOptionId )
-    {
-        return dataSetStore.getMobileDataSetsFromCategoryOption( categoryOptionId );
-    }
-
-    public Collection<DataSet> getMobileDataSetsFromCategory( int categoryId )
-    {
-        return dataSetStore.getMobileDataSetsFromCategory( categoryId );
-    }
-
     @Override
     public int getDataSetCount()
     {

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/hibernate/HibernateDataSetStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/hibernate/HibernateDataSetStore.java	2011-07-22 20:43:53 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/hibernate/HibernateDataSetStore.java	2011-09-27 10:12:47 +0000
@@ -27,16 +27,8 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.sql.ResultSet;
-import java.sql.Statement;
-import java.util.ArrayList;
 import java.util.Collection;
-import java.util.List;
 
-import org.amplecode.quick.StatementHolder;
-import org.amplecode.quick.StatementManager;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.hibernate.Criteria;
 import org.hibernate.Query;
 import org.hibernate.Session;
@@ -57,19 +49,10 @@
     extends HibernateGenericStore<DataSet>
     implements DataSetStore
 {
-    private static final Log log = LogFactory.getLog( HibernateDataSetStore.class );
-
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
     
-    private StatementManager statementManager;
-
-    public void setStatementManager( StatementManager statementManager )
-    {
-        this.statementManager = statementManager;
-    }
-
     private PeriodStore periodStore;
 
     public void setPeriodStore( PeriodStore periodStore )
@@ -204,71 +187,6 @@
         return query.list();
     }    
 
-    public Collection<DataSet> getMobileDataSetsFromCategoryOption( int categoryOptionId )
-    {
-        StatementHolder holder = statementManager.getHolder();
-
-        List<DataSet> mobileDataSets = new ArrayList<DataSet>();
-
-        try
-        {
-            Statement statement = holder.getStatement();
-
-            ResultSet resultSet = statement.executeQuery( "select * from dataset where datasetid in " +
-                "(select DISTINCT datasetid from datasetmembers where dataelementid in (select dataelementid from dataelement where categorycomboid in " +
-                "(select categorycomboid from categorycombos_categories where categoryid in (select categoryid from categories_categoryoptions where categoryoptionid = '"
-                + categoryOptionId + "')))) and (mobile = true and mobile is not null)" );
-
-            while ( resultSet.next() )
-            {
-                DataSet dataSet = getDataSet( resultSet.getInt( 1 ) );
-                mobileDataSets.add( dataSet );
-            }
-        }
-        catch ( Exception ex )
-        {
-            log.error( ex );
-        }
-        finally
-        {
-            holder.close();
-        }
-
-        return mobileDataSets;
-    }
-
-    public Collection<DataSet> getMobileDataSetsFromCategory( int categoryId )
-    {
-        StatementHolder holder = statementManager.getHolder();
-
-        List<DataSet> mobileDataSets = new ArrayList<DataSet>();
-
-        try
-        {
-            Statement statement = holder.getStatement();
-
-            ResultSet resultSet = statement.executeQuery( "select * from dataset where datasetid in " + 
-                "(select DISTINCT datasetid from datasetmembers where dataelementid in " +
-                "(select dataelementid from dataelement where categorycomboid in (select categorycomboid from categorycombos_categories where categoryid ='"
-                + categoryId + "'))) and (mobile = true and mobile is not null)" );
-            
-            while ( resultSet.next() )
-            {
-                DataSet dataSet = getDataSet( resultSet.getInt( 1 ) );
-                mobileDataSets.add( dataSet );
-            }
-        }
-        catch ( Exception ex )
-        {
-            log.error( ex );
-        }
-        finally
-        {
-            holder.close();
-        }
-        return mobileDataSets;
-    }
-    
     @Override
     public int getDataSetCount()
     {

=== 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-09-22 13:25:54 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2011-09-27 10:12:47 +0000
@@ -81,7 +81,6 @@
     <property name="clazz" value="org.hisp.dhis.dataset.DataSet" />
     <property name="sessionFactory" ref="sessionFactory" />
     <property name="periodStore" ref="org.hisp.dhis.period.PeriodStore" />
-    <property name="statementManager" ref="statementManager" />
     <property name="cacheable" value="true" />
   </bean>
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/GetDataElementCategoryAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/GetDataElementCategoryAction.java	2010-09-04 07:26:32 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/GetDataElementCategoryAction.java	2011-09-27 10:12:47 +0000
@@ -101,7 +101,6 @@
     {
         dataElementCategory = dataElementCategoryService.getDataElementCategory( id );
 
-        // Concept list
         concepts = new ArrayList<Concept>( conceptService.getAllConcepts() );
 
         Collections.sort( concepts, new ConceptNameComparator() );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateDataElementCategoryAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateDataElementCategoryAction.java	2010-12-22 04:05:46 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateDataElementCategoryAction.java	2011-09-27 10:12:47 +0000
@@ -28,14 +28,11 @@
  */
 
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.List;
 
 import org.hisp.dhis.concept.ConceptService;
 import org.hisp.dhis.dataelement.DataElementCategory;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
-import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.dataset.DataSetService;
 
 import com.opensymphony.xwork2.Action;
 
@@ -64,12 +61,6 @@
         this.conceptService = conceptService;
     }
 
-    private DataSetService dataSetService;
-    
-    public void setDataSetService( DataSetService dataSetService )
-    {
-        this.dataSetService = dataSetService;
-    } 
     // -------------------------------------------------------------------------
     // Input
     // -------------------------------------------------------------------------
@@ -126,11 +117,6 @@
 
         dataElementCategoryService.updateDataElementCategory( dataElementCategory );
 
-        Collection<DataSet> dataSets = dataSetService.getMobileDataSetsFromCategory(dataElementCategory.getId());
-        for(DataSet dataSet : dataSets){
-            dataSet.setVersion( dataSet.getVersion() + 1 );
-            dataSetService.updateDataSet( dataSet );
-        }
         return SUCCESS;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateDataElementCategoryOptionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateDataElementCategoryOptionAction.java	2010-12-22 04:05:46 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/category/UpdateDataElementCategoryOptionAction.java	2011-09-27 10:12:47 +0000
@@ -27,12 +27,8 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.Collection;
-
 import org.hisp.dhis.dataelement.DataElementCategoryOption;
 import org.hisp.dhis.dataelement.DataElementCategoryService;
-import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.dataset.DataSetService;
 
 import com.opensymphony.xwork2.Action;
 
@@ -54,13 +50,6 @@
         this.dataElementCategoryService = dataElementCategoryService;
     }  
     
-    private DataSetService dataSetService;
-    
-    public void setDataSetService( DataSetService dataSetService )
-    {
-        this.dataSetService = dataSetService;
-    }    
-
     // -------------------------------------------------------------------------
     // Input
     // -------------------------------------------------------------------------    
@@ -85,17 +74,10 @@
 
     public String execute()
     {
-        DataElementCategoryOption categoryOption = dataElementCategoryService
-            .getDataElementCategoryOption( id );
+        DataElementCategoryOption categoryOption = dataElementCategoryService.getDataElementCategoryOption( id );
         categoryOption.setName( name );
         dataElementCategoryService.updateDataElementCategoryOption( categoryOption );
 
-        Collection<DataSet> dataSets = dataSetService.getMobileDataSetsFromCategoryOption(id);
-        for(DataSet dataSet : dataSets){
-            dataSet.setVersion( dataSet.getVersion() + 1 );
-            dataSetService.updateDataSet( dataSet );
-        }
         return SUCCESS;
     }
-
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml	2011-09-27 07:36:07 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml	2011-09-27 10:12:47 +0000
@@ -581,9 +581,6 @@
     <property name="conceptService">
       <ref bean="org.hisp.dhis.concept.ConceptService" />
     </property>
-    <property name="dataSetService">
-      <ref bean="org.hisp.dhis.dataset.DataSetService" />
-    </property>
   </bean>
 
   <bean id="org.hisp.dhis.dd.action.category.GetDataElementCategoryAction" class="org.hisp.dhis.dd.action.category.GetDataElementCategoryAction"
@@ -608,9 +605,6 @@
     <property name="dataElementCategoryService">
       <ref bean="org.hisp.dhis.dataelement.DataElementCategoryService" />
     </property>
-    <property name="dataSetService">
-      <ref bean="org.hisp.dhis.dataset.DataSetService" />
-    </property>
   </bean>
 
   <!-- CategoryCombo -->