dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #02336
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 789: Minor performance fix in data entry.
------------------------------------------------------------
revno: 789
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Mon 2009-09-28 17:37:28 +0200
message:
Minor performance fix in data entry.
modified:
dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SelectAction.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-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SelectAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SelectAction.java 2009-09-10 13:17:59 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SelectAction.java 2009-09-28 15:37:28 +0000
@@ -34,11 +34,11 @@
import java.util.List;
import java.util.Map;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hisp.dhis.dataelement.CalculatedDataElement;
import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.datalock.DataSetLock;
import org.hisp.dhis.datalock.DataSetLockService;
import org.hisp.dhis.dataset.CompleteDataSetRegistration;
import org.hisp.dhis.dataset.CompleteDataSetRegistrationService;
@@ -60,14 +60,14 @@
*/
public class SelectAction
extends ActionSupport
-{
+{
private static final String SECTION_FORM = "sectionform";
private static final Log log = LogFactory.getLog( SelectAction.class );
// -------------------------------------------------------------------------
// Dependencies
- // -------------------------------------------------------------------------
+ // -------------------------------------------------------------------------
private SelectedStateManager selectedStateManager;
@@ -75,7 +75,7 @@
{
this.selectedStateManager = selectedStateManager;
}
-
+
private DataEntryScreenManager dataEntryScreenManager;
public void setDataEntryScreenManager( DataEntryScreenManager dataEntryScreenManager )
@@ -88,7 +88,7 @@
public void setDataSetService( DataSetService dataSetService )
{
this.dataSetService = dataSetService;
- }
+ }
private DataEntryFormService dataEntryFormService;
@@ -103,10 +103,10 @@
{
this.registrationService = registrationService;
}
-
+
private DataSetLockService dataSetLockService;
-
- public void setDataSetLockService( DataSetLockService dataSetLockService)
+
+ public void setDataSetLockService( DataSetLockService dataSetLockService )
{
this.dataSetLockService = dataSetLockService;
}
@@ -281,11 +281,11 @@
}
// ---------------------------------------------------------------------
- // Load and Sort DataSets
+ // Load and sort DataSets
// ---------------------------------------------------------------------
- dataSets = selectedStateManager.loadDataSetsForSelectedOrgUnit( organisationUnit );
-
+ dataSets = selectedStateManager.loadDataSetsForSelectedOrgUnit( organisationUnit );
+
Collections.sort( dataSets, new DataSetNameComparator() );
// ---------------------------------------------------------------------
@@ -318,7 +318,7 @@
return SUCCESS;
}
-
+
// ---------------------------------------------------------------------
// Generate Periods
// ---------------------------------------------------------------------
@@ -334,23 +334,26 @@
selectedPeriodIndex = selectedStateManager.getSelectedPeriodIndex();
}
- //-----------------------------------------------------------------------
- // For Data Locking
- //-----------------------------------------------------------------------
-
- if ( selectedPeriodIndex != null && selectedPeriodIndex >= 0 && selectedPeriodIndex < periods.size() ){
- selectedStateManager.setSelectedPeriodIndex( selectedPeriodIndex );
-
- if( selectedDataSet != null ){
- period = selectedStateManager.getSelectedPeriod();
-
- if(dataSetLockService.getDataSetLockByDataSetAndPeriod( selectedDataSet, period ) != null){
- if( dataSetLockService.getDataSetLockByDataSetAndPeriod( selectedDataSet, period ).getSources().contains(organisationUnit) ) {
- locked = true;
- log.info( "Dataset '" + selectedDataSet.getName() + "' is locked " );
- }
- }
- }
+ // -----------------------------------------------------------------------
+ // For Data Locking
+ // -----------------------------------------------------------------------
+
+ if ( selectedPeriodIndex != null && selectedPeriodIndex >= 0 && selectedPeriodIndex < periods.size() )
+ {
+ selectedStateManager.setSelectedPeriodIndex( selectedPeriodIndex );
+
+ if ( selectedDataSet != null )
+ {
+ period = selectedStateManager.getSelectedPeriod();
+
+ DataSetLock dataSetLock = dataSetLockService.getDataSetLockByDataSetAndPeriod( selectedDataSet, period );
+
+ if ( dataSetLock != null && dataSetLock.getSources().contains( organisationUnit ) )
+ {
+ locked = true;
+ log.info( "Dataset '" + selectedDataSet.getName() + "' is locked " );
+ }
+ }
}
else
{
@@ -361,19 +364,19 @@
}
period = selectedStateManager.getSelectedPeriod();
-
+
// ---------------------------------------------------------------------
// Get Section Information
- // ---------------------------------------------------------------------
-
- haveSection = dataEntryScreenManager.hasSection( selectedDataSet ) ;
-
+ // ---------------------------------------------------------------------
+
+ haveSection = dataEntryScreenManager.hasSection( selectedDataSet );
+
// ---------------------------------------------------------------------
// Get CalculatedDataElementInformation
// ---------------------------------------------------------------------
- calculatedDataElementIds = dataEntryScreenManager.getAllCalculatedDataElements( selectedDataSet );
- calculatedDataElementMap = dataEntryScreenManager.getNonSavedCalculatedDataElements( selectedDataSet );
+ calculatedDataElementIds = dataEntryScreenManager.getAllCalculatedDataElements( selectedDataSet );
+ calculatedDataElementMap = dataEntryScreenManager.getNonSavedCalculatedDataElements( selectedDataSet );
// ---------------------------------------------------------------------
// Get the custom data entry form if any
@@ -381,7 +384,7 @@
DataEntryForm dataEntryForm = dataEntryFormService.getDataEntryFormByDataSet( selectedDataSet );
- customDataEntryFormExists = ( dataEntryForm != null );
+ customDataEntryFormExists = (dataEntryForm != null);
// ---------------------------------------------------------------------
// Make available information about dataSet completeness
@@ -398,7 +401,7 @@
{
return SECTION_FORM;
}
-
- return dataEntryScreenManager.getScreenType( selectedDataSet );
+
+ return dataEntryScreenManager.getScreenType( selectedDataSet );
}
}