dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #36388
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18623: Data entry, performance improvement for data set loading
------------------------------------------------------------
revno: 18623
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-03-19 00:16:20 +0100
message:
Data entry, performance improvement for data set loading
modified:
dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.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/LoadFormAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java 2015-02-10 04:21:31 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java 2015-03-18 23:16:20 +0000
@@ -213,13 +213,6 @@
return greyedFields;
}
- private List<DataElement> dataElementsNotInForm = new ArrayList<>();
-
- public List<DataElement> getDataElementsNotInForm()
- {
- return dataElementsNotInForm;
- }
-
private DataSet dataSet;
public DataSet getDataSet()
@@ -235,15 +228,31 @@
public String execute()
throws Exception
{
- if ( dataSetId == null )
- {
- return INPUT;
- }
-
dataSet = dataSetService.getDataSet( dataSetId, true, false, false, true );
- List<DataElement> dataElements = new ArrayList<>( dataElementService.getDataElements( dataSet, null,
- null ) );
+ if ( dataSet == null )
+ {
+ return INPUT;
+ }
+
+ String dataSetType = dataSet.getDataSetType();
+
+ // ---------------------------------------------------------------------
+ // Custom form
+ // ---------------------------------------------------------------------
+
+ if ( DataSet.TYPE_CUSTOM.equals( dataSetType ) && dataSet.hasDataEntryForm() )
+ {
+ dataEntryForm = dataSet.getDataEntryForm();
+ customDataEntryFormCode = dataEntryFormService.prepareDataEntryFormForEntry( dataEntryForm.getHtmlCode(), i18n, dataSet );
+ return dataSetType;
+ }
+
+ // ---------------------------------------------------------------------
+ // Section / default form
+ // ---------------------------------------------------------------------
+
+ List<DataElement> dataElements = new ArrayList<>( dataElementService.getDataElements( dataSet, null, null ) );
if ( dataElements.isEmpty() )
{
@@ -320,10 +329,9 @@
// Get data entry form
// ---------------------------------------------------------------------
- String displayMode = dataSet.getDataSetType();
DataSet dsOriginal = dataSet;
- if ( displayMode.equals( DataSet.TYPE_DEFAULT ) )
+ if ( dataSetType.equals( DataSet.TYPE_DEFAULT ) )
{
DataSet dataSetCopy = new DataSet();
dataSetCopy.setName( dataSet.getName() );
@@ -347,7 +355,7 @@
section.setIndicators( new ArrayList<>( dataSet.getIndicators() ) );
}
- displayMode = DataSet.TYPE_SECTION;
+ dataSetType = DataSet.TYPE_SECTION;
}
// ---------------------------------------------------------------------
@@ -378,19 +386,12 @@
getSectionForm( dataElements, dataSet );
- displayMode = DataSet.TYPE_SECTION_MULTIORG;
- }
-
- if ( displayMode.equals( DataSet.TYPE_SECTION ) )
- {
- getSectionForm( dataElements, dataSet );
- }
- else
- {
- getOtherDataEntryForm( dataElements, dataSet );
- }
-
- return displayMode;
+ dataSetType = DataSet.TYPE_SECTION_MULTIORG;
+ }
+
+ getSectionForm( dataElements, dataSet );
+
+ return dataSetType;
}
// -------------------------------------------------------------------------
@@ -423,30 +424,4 @@
}
}
}
-
- private void getOtherDataEntryForm( List<DataElement> dataElements, DataSet dataSet )
- {
- dataEntryForm = dataSet.getDataEntryForm();
-
- if ( dataEntryForm != null )
- {
- customDataEntryFormCode = dataEntryFormService.prepareDataEntryFormForEntry( dataEntryForm.getHtmlCode(),
- i18n, dataSet );
-
- dataElementsNotInForm = new ArrayList<>( dataSet.getDataElements() );
- dataElementsNotInForm.removeAll( dataEntryFormService.getDataElementsInDataEntryForm( dataSet ) );
- Collections.sort( dataElementsNotInForm, IdentifiableObjectNameComparator.INSTANCE );
- }
-
- List<DataElement> des;
-
- for ( DataElementCategoryCombo categoryCombo : orderedCategoryCombos )
- {
- des = orderedDataElements.get( categoryCombo );
-
- Collections.sort( des, IdentifiableObjectNameComparator.INSTANCE );
-
- orderedDataElements.put( categoryCombo, des );
- }
- }
}