← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10134: Making certain methods in expressionservice non-transactional to avoid unecessary overhead

 

------------------------------------------------------------
revno: 10134
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-03-11 13:18:15 +0100
message:
  Making certain methods in expressionservice non-transactional to avoid unecessary overhead
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.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-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	2013-03-07 15:02:47 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/DefaultExpressionService.java	2013-03-11 12:18:15 +0000
@@ -71,7 +71,6 @@
  * @version $Id: DefaultExpressionService.java 6463 2008-11-24 12:05:46Z
  *          larshelg $
  */
-@Transactional
 public class DefaultExpressionService
     implements ExpressionService
 {
@@ -113,26 +112,31 @@
     // Expression CRUD operations
     // -------------------------------------------------------------------------
 
+    @Transactional
     public int addExpression( Expression expression )
     {
         return expressionStore.save( expression );
     }
 
+    @Transactional
     public void deleteExpression( Expression expression )
     {
         expressionStore.delete( expression );
     }
 
+    @Transactional
     public Expression getExpression( int id )
     {
         return expressionStore.get( id );
     }
 
+    @Transactional
     public void updateExpression( Expression expression )
     {
         expressionStore.update( expression );
     }
 
+    @Transactional
     public Collection<Expression> getAllExpressions()
     {
         return expressionStore.getAll();
@@ -174,6 +178,7 @@
         return expressionString != null ? calculateExpression( expressionString ) : null;
     }
 
+    @Transactional
     public Set<DataElement> getDataElementsInExpression( String expression )
     {
         Set<DataElement> dataElementsInExpression = null;
@@ -198,6 +203,7 @@
         return dataElementsInExpression;
     }
 
+    @Transactional
     public Set<DataElementCategoryOptionCombo> getOptionCombosInExpression( String expression )
     {
         Set<DataElementCategoryOptionCombo> optionCombosInExpression = null;
@@ -222,11 +228,10 @@
 
         return optionCombosInExpression;
     }
-    
+
+    @Transactional
     public Set<DataElementOperand> getOperandsInExpression( String expression )
     {
-        //TODO reimplement using uids
-        
         Set<DataElementOperand> operandsInExpression = null;
 
         if ( expression != null )
@@ -243,7 +248,8 @@
 
         return operandsInExpression;
     }
-    
+
+    @Transactional
     public Set<DataElement> getDataElementsInIndicators( Collection<Indicator> indicators )
     {
         Set<DataElement> dataElements = new HashSet<DataElement>();
@@ -266,7 +272,8 @@
         
         return dataElements;
     }
-    
+
+    @Transactional
     public void filterInvalidIndicators( Collection<Indicator> indicators )
     {
         if ( indicators != null )
@@ -287,11 +294,13 @@
         }
     }
 
+    @Transactional
     public String expressionIsValid( String formula )
     {
         return expressionIsValid( formula, null, null, null );
     }
-    
+
+    @Transactional
     public String expressionIsValid( String expression, Set<String> dataElements, Set<String> categoryOptionCombos, Set<String> constants )
     {
         if ( expression == null || expression.isEmpty() )
@@ -362,6 +371,7 @@
         return VALID;
     }
 
+    @Transactional
     public String getExpressionDescription( String expression )
     {
         if ( expression == null || expression.isEmpty() )
@@ -439,6 +449,7 @@
         return expression;
     }
 
+    @Transactional
     public void explodeAndSubstituteExpressions( Collection<Indicator> indicators, Integer days )
     {
         if ( indicators != null && !indicators.isEmpty() )
@@ -488,7 +499,8 @@
 
         return appendTail( matcher, sb );
     }
-    
+
+    @Transactional
     public String explodeExpression( String expression )
     {
         if ( expression == null || expression.isEmpty() )
@@ -522,7 +534,8 @@
 
         return appendTail( matcher, sb );
     }
-    
+
+    @Transactional
     public String substituteExpression( String expression, Integer days )
     {
         if ( expression == null || expression.isEmpty() )
@@ -566,7 +579,8 @@
         
         return appendTail( matcher, sb );
     }
-    
+
+    @Transactional
     public String generateExpression( String expression, Map<DataElementOperand, Double> valueMap, Map<String, Double> constantMap, Integer days, boolean nullIfNoValues )
     {
         if ( expression == null || expression.isEmpty() )
@@ -634,6 +648,7 @@
         return appendTail( matcher, sb );
     }
 
+    @Transactional
     public Set<DataElementOperand> getOperandsInIndicators( Collection<Indicator> indicators )
     {
         final Set<DataElementOperand> operands = new HashSet<DataElementOperand>();