dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #42175
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21542: Expression service, performance improvement
------------------------------------------------------------
revno: 21542
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-12-29 13:40:22 +0100
message:
Expression service, performance improvement
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java
dhis-2/dhis-services/dhis-service-core/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-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java 2015-12-12 12:43:41 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java 2015-12-29 12:40:22 +0000
@@ -54,6 +54,7 @@
import org.hisp.dhis.common.DimensionService;
import org.hisp.dhis.common.DimensionalItemObject;
import org.hisp.dhis.common.GenericStore;
+import org.hisp.dhis.common.IdentifiableObjectManager;
import org.hisp.dhis.common.ListMap;
import org.hisp.dhis.common.RegexUtils;
import org.hisp.dhis.common.exception.InvalidIdentifierReferenceException;
@@ -135,6 +136,13 @@
{
this.dimensionService = dimensionService;
}
+
+ private IdentifiableObjectManager idObjectManager;
+
+ public void setIdObjectManager( IdentifiableObjectManager idObjectManager )
+ {
+ this.idObjectManager = idObjectManager;
+ }
// -------------------------------------------------------------------------
// Expression CRUD operations
@@ -238,8 +246,6 @@
Double result = expressionString != null ? calculateExpression( expressionString ) : null;
- log.debug( "Expression: " + expression.getExplodedExpressionFallback() + ", generated: " + expressionString + ", result: " + result );
-
return result;
}
@@ -510,7 +516,7 @@
{
String constant = matcher.group( 1 );
- if ( constantService.getConstant( constant ) == null )
+ if ( idObjectManager.getNoAcl( Constant.class, constant ) == null )
{
return ExpressionValidationOutcome.CONSTANT_DOES_NOT_EXIST;
}
@@ -531,7 +537,7 @@
{
String group = matcher.group( 1 );
- if ( organisationUnitGroupService.getOrganisationUnitGroup( group ) == null )
+ if ( idObjectManager.getNoAcl( OrganisationUnitGroup.class, group ) == null )
{
return ExpressionValidationOutcome.ORG_UNIT_GROUP_DOES_NOT_EXIST;
}
@@ -750,7 +756,7 @@
{
final StringBuilder replace = new StringBuilder( PAR_OPEN );
- final DataElement dataElement = dataElementService.getDataElement( matcher.group( 1 ) );
+ final DataElement dataElement = idObjectManager.getNoAcl( DataElement.class, matcher.group( 1 ) );
final DataElementCategoryCombo categoryCombo = dataElement.getCategoryCombo();
@@ -788,7 +794,7 @@
{
String co = matcher.group( 1 );
- Constant constant = constantService.getConstant( co );
+ Constant constant = idObjectManager.getNoAcl( Constant.class, co );
String replacement = constant != null ? String.valueOf( constant.getValue() ) : NULL_REPLACEMENT;
@@ -808,7 +814,7 @@
{
String oug = matcher.group( 1 );
- OrganisationUnitGroup group = organisationUnitGroupService.getOrganisationUnitGroup( oug );
+ OrganisationUnitGroup group = idObjectManager.get( OrganisationUnitGroup.class, oug );
String replacement = group != null ? String.valueOf( group.getMembers().size() ) : NULL_REPLACEMENT;
=== 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 2015-12-21 16:44:02 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2015-12-29 12:40:22 +0000
@@ -741,6 +741,7 @@
<property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
<property name="organisationUnitGroupService" ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
<property name="dimensionService" ref="org.hisp.dhis.dimension.DimensionService" />
+ <property name="idObjectManager" ref="org.hisp.dhis.common.IdentifiableObjectManager" />
</bean>
<bean id="org.hisp.dhis.validation.ValidationRuleService" class="org.hisp.dhis.validation.DefaultValidationRuleService">