dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18978
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8099: Improved performance for integrity checks
------------------------------------------------------------
revno: 8099
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2012-09-15 16:27:07 +0200
message:
Improved performance for integrity checks
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataentryform/DataEntryFormService.java
dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataintegrity/DefaultDataIntegrityService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.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-api/src/main/java/org/hisp/dhis/dataentryform/DataEntryFormService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataentryform/DataEntryFormService.java 2012-09-15 11:19:46 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataentryform/DataEntryFormService.java 2012-09-15 14:27:07 +0000
@@ -143,7 +143,7 @@
*/
String prepareDataEntryFormForEntry( String htmlCode, I18n i18n, DataSet dataSet );
- Set<DataElement> getDataElementsInDataEntryForm( DataEntryForm form );
+ Set<DataElement> getDataElementsInDataEntryForm( DataSet dataSet );
Collection<DataEntryForm> listDisctinctDataEntryFormByProgramStageIds( List<Integer> programStageIds );
=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataintegrity/DefaultDataIntegrityService.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataintegrity/DefaultDataIntegrityService.java 2012-07-21 17:19:38 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/dataintegrity/DefaultDataIntegrityService.java 2012-09-15 14:27:07 +0000
@@ -250,7 +250,7 @@
if ( dataSet.hasDataEntryForm() )
{
- formElements.addAll( dataEntryFormService.getDataElementsInDataEntryForm( dataSet.getDataEntryForm() ) );
+ formElements.addAll( dataEntryFormService.getDataElementsInDataEntryForm( dataSet ) );
}
else if ( dataSet.hasSections() )
{
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java 2012-09-15 12:05:37 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java 2012-09-15 14:27:07 +0000
@@ -332,11 +332,18 @@
return sb.toString();
}
- public Set<DataElement> getDataElementsInDataEntryForm( DataEntryForm form )
+ public Set<DataElement> getDataElementsInDataEntryForm( DataSet dataSet )
{
+ if ( dataSet == null || dataSet.getDataEntryForm() == null )
+ {
+ return null;
+ }
+
+ Map<Integer, DataElement> dataElementMap = getDataElementMap( dataSet );
+
Set<DataElement> dataElements = new HashSet<DataElement>();
- Matcher inputMatcher = INPUT_PATTERN.matcher( form.getHtmlCode() );
+ Matcher inputMatcher = INPUT_PATTERN.matcher( dataSet.getDataEntryForm().getHtmlCode() );
while ( inputMatcher.find() )
{
@@ -350,12 +357,12 @@
if ( identifierMatcher.find() && identifierMatcher.groupCount() > 0 )
{
int dataElementId = Integer.parseInt( identifierMatcher.group( 1 ) );
- dataElement = dataElementService.getDataElement( dataElementId );
+ dataElement = dataElementMap.get( dataElementId );
}
else if ( dataElementTotalMatcher.find() && dataElementTotalMatcher.groupCount() > 0 )
{
int dataElementId = Integer.parseInt( dataElementTotalMatcher.group( 1 ) );
- dataElement = dataElementService.getDataElement( dataElementId );
+ dataElement = dataElementMap.get( dataElementId );
}
if ( dataElement != null )