← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4208: Removed now outdated action class

 

------------------------------------------------------------
revno: 4208
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-07-25 22:12:49 +0200
message:
  Removed now outdated action class
removed:
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadDataSetsAction.java
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.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-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-07-25 09:10:33 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java	2011-07-25 20:12:49 +0000
@@ -423,11 +423,11 @@
     
     public OrganisationUnitDataSetAssociationSet getOrganisationUnitDataSetAssociationSet()
     {
-        //TODO hierarchy ?
+        //TODO hierarchy
         
         Map<Integer, Set<Integer>> associationSet = organisationUnitStore.getOrganisationUnitDataSetAssocationMap();
         
-        filterOrganisationUnitSortedDataSets( associationSet );
+        filterUserDataSets( associationSet );
         
         OrganisationUnitDataSetAssociationSet set = new OrganisationUnitDataSetAssociationSet();
         
@@ -447,7 +447,7 @@
         return set;
     }
     
-    private void filterOrganisationUnitSortedDataSets( Map<Integer, Set<Integer>> associationMap )
+    private void filterUserDataSets( Map<Integer, Set<Integer>> associationMap )
     {
         User currentUser = currentUserService.getCurrentUser();
         

=== removed file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadDataSetsAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadDataSetsAction.java	2011-07-22 09:17:04 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadDataSetsAction.java	1970-01-01 00:00:00 +0000
@@ -1,176 +0,0 @@
-package org.hisp.dhis.de.action;
-
-/*
- * 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.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.dataset.DataSetService;
-import org.hisp.dhis.dataset.comparator.DataSetNameComparator;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
-import org.hisp.dhis.period.CalendarPeriodType;
-import org.hisp.dhis.user.CurrentUserService;
-import org.hisp.dhis.user.User;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Lars Helge Overland
- */
-public class LoadDataSetsAction
-    implements Action
-{
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private OrganisationUnitSelectionManager selectionManager;
-
-    public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
-    {
-        this.selectionManager = selectionManager;
-    }
-
-    private CurrentUserService currentUserService;
-
-    public void setCurrentUserService( CurrentUserService currentUserService )
-    {
-        this.currentUserService = currentUserService;
-    }
-
-    private DataSetService dataSetService;
-
-    public void setDataSetService( DataSetService dataSetService )
-    {
-        this.dataSetService = dataSetService;
-    }
-    
-    // -------------------------------------------------------------------------
-    // Input
-    // -------------------------------------------------------------------------
-
-    private Integer dataSetId;
-
-    public void setDataSetId( Integer dataSetId )
-    {
-        this.dataSetId = dataSetId;
-    }
-    
-    // -------------------------------------------------------------------------
-    // Output
-    // -------------------------------------------------------------------------
-
-    private List<DataSet> dataSets = new ArrayList<DataSet>();
-
-    public Collection<DataSet> getDataSets()
-    {
-        return dataSets;
-    }
-        
-    private boolean dataSetValid;
-
-    public boolean isDataSetValid()
-    {
-        return dataSetValid;
-    }
-        
-    // -------------------------------------------------------------------------
-    // Action implementation
-    // -------------------------------------------------------------------------
-
-    public String execute()
-    {
-        OrganisationUnit organisationUnit = selectionManager.getSelectedOrganisationUnit();
-
-        if ( organisationUnit != null )
-        {        
-            // -----------------------------------------------------------------
-            // Load data sets for selected org unit
-            // -----------------------------------------------------------------
-
-            dataSets = loadDataSetsForSelectedOrgUnit( organisationUnit );
-    
-            Collections.sort( dataSets, new DataSetNameComparator() );
-
-            // -----------------------------------------------------------------
-            // Check if selected data set is associated with selected org unit
-            // -----------------------------------------------------------------
-
-            if ( dataSetId != null )
-            {
-                DataSet selectedDataSet = dataSetService.getDataSet( dataSetId );
-                
-                if ( selectedDataSet != null && dataSets.contains( selectedDataSet ) )
-                {
-                    dataSetValid = true;
-                }
-            }
-        }
-        
-        return SUCCESS;
-    }
-    
-    private List<DataSet> loadDataSetsForSelectedOrgUnit( OrganisationUnit organisationUnit )
-    {
-        List<DataSet> dataSets = new ArrayList<DataSet>( organisationUnit.getDataSets() );
-
-        // ---------------------------------------------------------------------
-        // Retain only DataSets from current user's authority groups
-        // ---------------------------------------------------------------------
-
-        User currentUser = currentUserService.getCurrentUser();
-        
-        if ( currentUser != null && !currentUserService.currentUserIsSuper() )
-        {
-            dataSets.retainAll( currentUser.getUserCredentials().getAllDataSets() );
-        }
-
-        // ---------------------------------------------------------------------
-        // Remove DataSets which don't have a CalendarPeriodType
-        // ---------------------------------------------------------------------
-
-        Iterator<DataSet> iterator = dataSets.iterator();
-
-        while ( iterator.hasNext() )
-        {
-            DataSet dataSet = iterator.next();
-
-            if ( !( dataSet.getPeriodType() instanceof CalendarPeriodType) )
-            {
-                iterator.remove();
-            }
-        }
-
-        return dataSets;
-    }
-}

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml	2011-07-22 20:54:42 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml	2011-07-25 20:12:49 +0000
@@ -29,12 +29,6 @@
     <property name="selectionManager" ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
   </bean>
 
-  <bean id="org.hisp.dhis.de.action.LoadDataSetsAction" class="org.hisp.dhis.de.action.LoadDataSetsAction" scope="prototype">
-    <property name="selectionManager" ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
-	<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
-	<property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
-  </bean>
-
   <bean id="org.hisp.dhis.de.action.LoadFormAction" class="org.hisp.dhis.de.action.LoadFormAction" scope="prototype">
     <property name="dataEntryFormService" ref="org.hisp.dhis.dataentryform.DataEntryFormService" />
     <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml	2011-07-21 17:58:42 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml	2011-07-25 20:12:49 +0000
@@ -22,10 +22,6 @@
 	  <result name="success" type="velocity-json">/dhis-web-dataentry/responseDataValues.vm</result>
 	</action>
 
-    <action name="loadDataSets" class="org.hisp.dhis.de.action.LoadDataSetsAction">
-      <result name="success" type="velocity-json">/dhis-web-dataentry/responseDataSets.vm</result>
-    </action>
-
     <action name="loadForm" class="org.hisp.dhis.de.action.LoadFormAction">
       <result name="custom" type="velocity">/dhis-web-dataentry/customForm.vm</result>
       <result name="section" type="velocity">/dhis-web-dataentry/sectionForm.vm</result>