← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2441: Factored out Operator into it's own enum type.

 

------------------------------------------------------------
revno: 2441
committer: Jo Størset <storset@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2010-12-29 15:36:33 +0530
message:
  Factored out Operator into it's own enum type.
added:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/expression/Operator.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/OperatorUserType.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/hibernate/
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/hibernate/EnumUserType.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRule.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/validation/hibernate/ValidationRule.hbm.xml
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleGroupStoreTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleServiceTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleStoreTest.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/ValidationRuleConverter.java
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/MathUtils.java
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/PDFUtils.java
  dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/MathUtilsTest.java
  dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java
  dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/AddValidationRuleAction.java
  dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/ExportValidationResultAction.java
  dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/GetValidationRuleAction.java
  dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/UpdateValidationRuleAction.java
  local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/meta/action/GenerateMetaDataReportResultAction.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
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/expression/Operator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/expression/Operator.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/expression/Operator.java	2010-12-29 10:06:33 +0000
@@ -0,0 +1,51 @@
+package org.hisp.dhis.expression;
+
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+public enum Operator
+{
+    equal_to( "==" ), 
+    not_equal_to( "!=" ), 
+    greater_than( ">" ), 
+    greater_than_or_equal_to( ">=" ), 
+    less_than( "<" ), 
+    less_than_or_equal_to( "<=" );
+
+    private final String mathematicalOperator;
+
+    Operator( String mathematicalOperator )
+    {
+        this.mathematicalOperator = mathematicalOperator;
+    }
+
+    public String getMathematicalOperator()
+    {
+        return mathematicalOperator;
+    }
+
+}

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRule.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRule.java	2010-05-26 15:58:31 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRule.java	2010-12-29 10:06:33 +0000
@@ -27,13 +27,12 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Map;
 import java.util.Set;
 
 import org.hisp.dhis.common.IdentifiableObject;
 import org.hisp.dhis.expression.Expression;
+import org.hisp.dhis.expression.Operator;
 import org.hisp.dhis.period.PeriodType;
 
 /**
@@ -46,20 +45,11 @@
     public static final String TYPE_STATISTICAL = "statistical";
     public static final String TYPE_ABSOLUTE = "absolute";
     
-    public static final String OPERATOR_EQUAL = "equal_to";
-    public static final String OPERATOR_NOT_EQUAL = "not_equal_to";
-    public static final String OPERATOR_GREATER = "greater_than";
-    public static final String OPERATOR_GREATER_EQUAL = "greater_than_or_equal_to";
-    public static final String OPERATOR_LESSER = "less_than";
-    public static final String OPERATOR_LESSER_EQUAL = "less_than_or_equal_to";
-    
-    private static Map<String, String> operatorMap = new HashMap<String, String>();
-    
     private String description;
     
     private String type;
 
-    private String operator;
+    private Operator operator;
     
     private Expression leftSide;
     
@@ -78,7 +68,7 @@
     }
 
     public ValidationRule( String name, String description, String type, 
-        String operator, Expression leftSide, Expression rightSide )
+        Operator operator, Expression leftSide, Expression rightSide )
     {
         this.name = name;
         this.description = description;
@@ -143,7 +133,7 @@
         this.description = description;
     }
     
-    public String getOperator()
+    public Operator getOperator()
     {
         return operator;
     }
@@ -158,7 +148,7 @@
         this.periodType = periodType;
     }
 
-    public void setOperator( String operator )
+    public void setOperator( Operator operator )
     {
         this.operator = operator;
     }
@@ -203,22 +193,4 @@
         this.groups = groups;
     }
 
-    // -------------------------------------------------------------------------
-    // Operator
-    // -------------------------------------------------------------------------  
-
-    static
-    {
-        operatorMap.put( OPERATOR_EQUAL, "==" );
-        operatorMap.put( OPERATOR_NOT_EQUAL, "!=" );
-        operatorMap.put( OPERATOR_GREATER, ">" );
-        operatorMap.put( OPERATOR_GREATER_EQUAL, ">=" );
-        operatorMap.put( OPERATOR_LESSER, "<" );
-        operatorMap.put( OPERATOR_LESSER_EQUAL, "<=" );
-    }
-    
-    public String getMathematicalOperator()
-    {
-        return operatorMap.get( operator );
-    }
 }

=== added file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/OperatorUserType.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/OperatorUserType.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/expression/OperatorUserType.java	2010-12-29 10:06:33 +0000
@@ -0,0 +1,37 @@
+package org.hisp.dhis.expression;
+
+import org.hisp.dhis.hibernate.EnumUserType;
+
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+public class OperatorUserType extends EnumUserType<Operator> { 
+
+    public OperatorUserType() { 
+        super(Operator.class); 
+    } 
+}
\ No newline at end of file

=== added directory 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/hibernate'
=== added file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/hibernate/EnumUserType.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/hibernate/EnumUserType.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/hibernate/EnumUserType.java	2010-12-29 10:06:33 +0000
@@ -0,0 +1,104 @@
+package org.hisp.dhis.hibernate;
+
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ *   list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ *   this list of conditions and the following disclaimer in the documentation
+ *   and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ *   be used to endorse or promote products derived from this software without
+ *   specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+import java.io.Serializable; 
+import java.sql.PreparedStatement; 
+import java.sql.ResultSet; 
+import java.sql.SQLException; 
+import java.sql.Types; 
+import org.hibernate.HibernateException; 
+import org.hibernate.usertype.UserType; 
+ 
+/**
+ * Template for storing enums. Borrowed from http://community.jboss.org/wiki/UserTypeforpersistinganEnumwithaVARCHARcolumn
+ */
+public class EnumUserType<E extends Enum<E>> implements UserType { 
+    private Class<E> clazz = null; 
+    protected EnumUserType(Class<E> c) { 
+        this.clazz = c; 
+    } 
+ 
+    private static final int[] SQL_TYPES = {Types.VARCHAR}; 
+    public int[] sqlTypes() { 
+        return SQL_TYPES; 
+    } 
+ 
+    public Class<?> returnedClass() { 
+        return clazz; 
+    } 
+ 
+    public Object nullSafeGet(ResultSet resultSet, String[] names, Object owner) throws HibernateException, SQLException { 
+        String name = resultSet.getString(names[0]); 
+        E result = null; 
+        if (!resultSet.wasNull()) { 
+            result = Enum.valueOf(clazz, name); 
+        } 
+        return result; 
+    } 
+ 
+    @SuppressWarnings( "rawtypes" )
+    public void nullSafeSet(PreparedStatement preparedStatement, Object value, int index) throws HibernateException, SQLException { 
+        if (null == value) { 
+            preparedStatement.setNull(index, Types.VARCHAR); 
+        } else { 
+            preparedStatement.setString(index, ((Enum)value).name()); 
+        } 
+    } 
+ 
+    public Object deepCopy(Object value) throws HibernateException{ 
+        return value; 
+    } 
+ 
+    public boolean isMutable() { 
+        return false; 
+    } 
+ 
+    public Object assemble(Serializable cached, Object owner) throws HibernateException {
+         return cached;
+    } 
+ 
+    public Serializable disassemble(Object value) throws HibernateException { 
+        return (Serializable)value; 
+    } 
+ 
+    public Object replace(Object original, Object target, Object owner) throws HibernateException { 
+        return original; 
+    } 
+    public int hashCode(Object x) throws HibernateException { 
+        return x.hashCode(); 
+    } 
+    public boolean equals(Object x, Object y) throws HibernateException { 
+        if (x == y) 
+            return true; 
+        if (null == x || null == y) 
+            return false; 
+        return x.equals(y); 
+    } 
+} 
\ No newline at end of file

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java	2010-12-27 00:21:07 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java	2010-12-29 10:06:33 +0000
@@ -305,7 +305,7 @@
     
                 if ( leftSide != null && rightSide != null )
                 {
-                    violation = !expressionIsTrue( leftSide, validationRule.getMathematicalOperator(), rightSide );
+                    violation = !expressionIsTrue( leftSide, validationRule.getOperator(), rightSide );
     
                     if ( violation )
                     {

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/validation/hibernate/ValidationRule.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/validation/hibernate/ValidationRule.hbm.xml	2010-05-28 19:17:07 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/validation/hibernate/ValidationRule.hbm.xml	2010-12-29 10:06:33 +0000
@@ -17,7 +17,7 @@
     
     <property name="type"/>
  
-    <property name="operator">
+    <property name="operator" type="org.hisp.dhis.expression.OperatorUserType">
       <column name="operator" not-null="true" unique="false"/>
     </property>
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleGroupStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleGroupStoreTest.java	2010-05-28 19:17:07 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleGroupStoreTest.java	2010-12-29 10:06:33 +0000
@@ -32,6 +32,8 @@
 import static junit.framework.Assert.assertNull;
 import static junit.framework.Assert.assertTrue;
 
+import static org.hisp.dhis.expression.Operator.*;
+
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.Set;
@@ -120,8 +122,8 @@
     @Test
     public void testAddValidationRuleGroup()
     {
-        ValidationRule ruleA = createValidationRule( 'A', ValidationRule.OPERATOR_EQUAL, null, null, periodType );
-        ValidationRule ruleB = createValidationRule( 'B', ValidationRule.OPERATOR_EQUAL, null, null, periodType );
+        ValidationRule ruleA = createValidationRule( 'A', equal_to, null, null, periodType );
+        ValidationRule ruleB = createValidationRule( 'B', equal_to, null, null, periodType );
         
         validationRuleStore.save( ruleA );
         validationRuleStore.save( ruleB );
@@ -147,8 +149,8 @@
     @Test
     public void testUpdateValidationRuleGroup()
     {
-        ValidationRule ruleA = createValidationRule( 'A', ValidationRule.OPERATOR_EQUAL, null, null, periodType );
-        ValidationRule ruleB = createValidationRule( 'B', ValidationRule.OPERATOR_EQUAL, null, null, periodType );
+        ValidationRule ruleA = createValidationRule( 'A', equal_to, null, null, periodType );
+        ValidationRule ruleB = createValidationRule( 'B', equal_to, null, null, periodType );
         
         validationRuleStore.save( ruleA );
         validationRuleStore.save( ruleB );
@@ -183,8 +185,8 @@
     @Test
     public void testDeleteValidationRuleGroup()
     {
-        ValidationRule ruleA = createValidationRule( 'A', ValidationRule.OPERATOR_EQUAL, null, null, periodType );
-        ValidationRule ruleB = createValidationRule( 'B', ValidationRule.OPERATOR_EQUAL, null, null, periodType );
+        ValidationRule ruleA = createValidationRule( 'A', equal_to, null, null, periodType );
+        ValidationRule ruleB = createValidationRule( 'B', equal_to, null, null, periodType );
         
         validationRuleStore.save( ruleA );
         validationRuleStore.save( ruleB );
@@ -220,8 +222,8 @@
     @Test
     public void testGetAllValidationRuleGroup()
     {
-        ValidationRule ruleA = createValidationRule( 'A', ValidationRule.OPERATOR_EQUAL, null, null, periodType );
-        ValidationRule ruleB = createValidationRule( 'B', ValidationRule.OPERATOR_EQUAL, null, null, periodType );
+        ValidationRule ruleA = createValidationRule( 'A', equal_to, null, null, periodType );
+        ValidationRule ruleB = createValidationRule( 'B', equal_to, null, null, periodType );
         
         validationRuleStore.save( ruleA );
         validationRuleStore.save( ruleB );
@@ -250,8 +252,8 @@
     @Test
     public void testGetValidationRuleGroupByName()
     {
-        ValidationRule ruleA = createValidationRule( 'A', ValidationRule.OPERATOR_EQUAL, null, null, periodType );
-        ValidationRule ruleB = createValidationRule( 'B', ValidationRule.OPERATOR_EQUAL, null, null, periodType );
+        ValidationRule ruleA = createValidationRule( 'A', equal_to, null, null, periodType );
+        ValidationRule ruleB = createValidationRule( 'B', equal_to, null, null, periodType );
         
         validationRuleStore.save( ruleA );
         validationRuleStore.save( ruleB );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleServiceTest.java	2010-10-29 12:19:15 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleServiceTest.java	2010-12-29 10:06:33 +0000
@@ -33,6 +33,7 @@
 import static junit.framework.Assert.assertNull;
 import static junit.framework.Assert.assertTrue;
 import static org.hisp.dhis.expression.Expression.SEPARATOR;
+import static org.hisp.dhis.expression.Operator.*;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -229,10 +230,10 @@
         dataElementService.updateDataElement( dataElementC );
         dataElementService.updateDataElement( dataElementD );
         
-        validationRuleA = createValidationRule( 'A', ValidationRule.OPERATOR_EQUAL, expressionA, expressionB, periodType );
-        validationRuleB = createValidationRule( 'B', ValidationRule.OPERATOR_GREATER, expressionB, expressionC, periodType );
-        validationRuleC = createValidationRule( 'C', ValidationRule.OPERATOR_LESSER_EQUAL, expressionB, expressionA, periodType );
-        validationRuleD = createValidationRule( 'D', ValidationRule.OPERATOR_LESSER, expressionA, expressionC, periodType );
+        validationRuleA = createValidationRule( 'A', equal_to, expressionA, expressionB, periodType );
+        validationRuleB = createValidationRule( 'B', greater_than, expressionB, expressionC, periodType );
+        validationRuleC = createValidationRule( 'C', less_than_or_equal_to, expressionB, expressionA, periodType );
+        validationRuleD = createValidationRule( 'D', less_than, expressionA, expressionC, periodType );
 
         group = createValidationRuleGroup( 'A' );
     }
@@ -528,7 +529,7 @@
         assertEquals( validationRuleA.getName(), "ValidationRuleA" );
         assertEquals( validationRuleA.getDescription(), "DescriptionA" );
         assertEquals( validationRuleA.getType(), ValidationRule.TYPE_ABSOLUTE );
-        assertEquals( validationRuleA.getOperator(), ValidationRule.OPERATOR_EQUAL );
+        assertEquals( validationRuleA.getOperator(), equal_to );
         assertNotNull( validationRuleA.getLeftSide().getExpression() );
         assertNotNull( validationRuleA.getRightSide().getExpression() );
         assertEquals( validationRuleA.getPeriodType(), periodType );
@@ -543,13 +544,13 @@
         assertEquals( validationRuleA.getName(), "ValidationRuleA" );
         assertEquals( validationRuleA.getDescription(), "DescriptionA" );
         assertEquals( validationRuleA.getType(), ValidationRule.TYPE_ABSOLUTE );
-        assertEquals( validationRuleA.getOperator(), ValidationRule.OPERATOR_EQUAL );
+        assertEquals( validationRuleA.getOperator(), equal_to );
 
         validationRuleA.setId( id );
         validationRuleA.setName( "ValidationRuleB" );
         validationRuleA.setDescription( "DescriptionB" );
         validationRuleA.setType( ValidationRule.TYPE_STATISTICAL );
-        validationRuleA.setOperator( ValidationRule.OPERATOR_GREATER );
+        validationRuleA.setOperator( greater_than );
 
         validationRuleService.updateValidationRule( validationRuleA );
         validationRuleA = validationRuleService.getValidationRule( id );
@@ -557,7 +558,7 @@
         assertEquals( validationRuleA.getName(), "ValidationRuleB" );
         assertEquals( validationRuleA.getDescription(), "DescriptionB" );
         assertEquals( validationRuleA.getType(), ValidationRule.TYPE_STATISTICAL );
-        assertEquals( validationRuleA.getOperator(), ValidationRule.OPERATOR_GREATER );
+        assertEquals( validationRuleA.getOperator(), greater_than );
     }
 
     @Test
@@ -616,8 +617,8 @@
     @Test
     public void testAddValidationRuleGroup()
     {
-        ValidationRule ruleA = createValidationRule( 'A', ValidationRule.OPERATOR_EQUAL, null, null, periodType );
-        ValidationRule ruleB = createValidationRule( 'B', ValidationRule.OPERATOR_EQUAL, null, null, periodType );
+        ValidationRule ruleA = createValidationRule( 'A', equal_to, null, null, periodType );
+        ValidationRule ruleB = createValidationRule( 'B', equal_to, null, null, periodType );
 
         validationRuleService.saveValidationRule( ruleA );
         validationRuleService.saveValidationRule( ruleB );
@@ -643,8 +644,8 @@
     @Test
     public void testUpdateValidationRuleGroup()
     {
-        ValidationRule ruleA = createValidationRule( 'A', ValidationRule.OPERATOR_EQUAL, null, null, periodType );
-        ValidationRule ruleB = createValidationRule( 'B', ValidationRule.OPERATOR_EQUAL, null, null, periodType );
+        ValidationRule ruleA = createValidationRule( 'A', equal_to, null, null, periodType );
+        ValidationRule ruleB = createValidationRule( 'B', equal_to, null, null, periodType );
 
         validationRuleService.saveValidationRule( ruleA );
         validationRuleService.saveValidationRule( ruleB );
@@ -679,8 +680,8 @@
     @Test
     public void testDeleteValidationRuleGroup()
     {
-        ValidationRule ruleA = createValidationRule( 'A', ValidationRule.OPERATOR_EQUAL, null, null, periodType );
-        ValidationRule ruleB = createValidationRule( 'B', ValidationRule.OPERATOR_EQUAL, null, null, periodType );
+        ValidationRule ruleA = createValidationRule( 'A', equal_to, null, null, periodType );
+        ValidationRule ruleB = createValidationRule( 'B', equal_to, null, null, periodType );
 
         validationRuleService.saveValidationRule( ruleA );
         validationRuleService.saveValidationRule( ruleB );
@@ -716,8 +717,8 @@
     @Test
     public void testGetAllValidationRuleGroup()
     {
-        ValidationRule ruleA = createValidationRule( 'A', ValidationRule.OPERATOR_EQUAL, null, null, periodType );
-        ValidationRule ruleB = createValidationRule( 'B', ValidationRule.OPERATOR_EQUAL, null, null, periodType );
+        ValidationRule ruleA = createValidationRule( 'A', equal_to, null, null, periodType );
+        ValidationRule ruleB = createValidationRule( 'B', equal_to, null, null, periodType );
 
         validationRuleService.saveValidationRule( ruleA );
         validationRuleService.saveValidationRule( ruleB );
@@ -746,8 +747,8 @@
     @Test
     public void testGetValidationRuleGroupByName()
     {
-        ValidationRule ruleA = createValidationRule( 'A', ValidationRule.OPERATOR_EQUAL, null, null, periodType );
-        ValidationRule ruleB = createValidationRule( 'B', ValidationRule.OPERATOR_EQUAL, null, null, periodType );
+        ValidationRule ruleA = createValidationRule( 'A', equal_to, null, null, periodType );
+        ValidationRule ruleB = createValidationRule( 'B', equal_to, null, null, periodType );
 
         validationRuleService.saveValidationRule( ruleA );
         validationRuleService.saveValidationRule( ruleB );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleStoreTest.java	2010-12-04 00:17:59 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleStoreTest.java	2010-12-29 10:06:33 +0000
@@ -27,6 +27,8 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import static org.hisp.dhis.expression.Operator.*;
+
 import static junit.framework.Assert.assertEquals;
 import static junit.framework.Assert.assertNotNull;
 import static junit.framework.Assert.assertNull;
@@ -125,7 +127,7 @@
     @Test
     public void testSaveValidationRule()
     {
-        ValidationRule validationRule = createValidationRule( 'A', ValidationRule.OPERATOR_EQUAL, expressionA,
+        ValidationRule validationRule = createValidationRule( 'A', equal_to, expressionA,
             expressionB, periodType );
 
         int id = validationRuleStore.saveValidationRule( validationRule );
@@ -135,7 +137,7 @@
         assertEquals( validationRule.getName(), "ValidationRuleA" );
         assertEquals( validationRule.getDescription(), "DescriptionA" );
         assertEquals( validationRule.getType(), ValidationRule.TYPE_ABSOLUTE );
-        assertEquals( validationRule.getOperator(), ValidationRule.OPERATOR_EQUAL );
+        assertEquals( validationRule.getOperator(), equal_to );
         assertNotNull( validationRule.getLeftSide().getExpression() );
         assertNotNull( validationRule.getRightSide().getExpression() );
         assertEquals( validationRule.getPeriodType(), periodType );
@@ -144,7 +146,7 @@
     @Test
     public void testUpdateValidationRule()
     {
-        ValidationRule validationRule = createValidationRule( 'A', ValidationRule.OPERATOR_EQUAL, expressionA,
+        ValidationRule validationRule = createValidationRule( 'A', equal_to, expressionA,
             expressionB, periodType );
 
         int id = validationRuleStore.saveValidationRule( validationRule );
@@ -154,12 +156,12 @@
         assertEquals( validationRule.getName(), "ValidationRuleA" );
         assertEquals( validationRule.getDescription(), "DescriptionA" );
         assertEquals( validationRule.getType(), ValidationRule.TYPE_ABSOLUTE );
-        assertEquals( validationRule.getOperator(), ValidationRule.OPERATOR_EQUAL );
+        assertEquals( validationRule.getOperator(), equal_to );
 
         validationRule.setName( "ValidationRuleB" );
         validationRule.setDescription( "DescriptionB" );
         validationRule.setType( ValidationRule.TYPE_STATISTICAL );
-        validationRule.setOperator( ValidationRule.OPERATOR_GREATER );
+        validationRule.setOperator( greater_than );
 
         validationRuleStore.updateValidationRule( validationRule );
 
@@ -168,15 +170,15 @@
         assertEquals( validationRule.getName(), "ValidationRuleB" );
         assertEquals( validationRule.getDescription(), "DescriptionB" );
         assertEquals( validationRule.getType(), ValidationRule.TYPE_STATISTICAL );
-        assertEquals( validationRule.getOperator(), ValidationRule.OPERATOR_GREATER );
+        assertEquals( validationRule.getOperator(), greater_than );
     }
 
     @Test
     public void testDeleteValidationRule()
     {
-        ValidationRule validationRuleA = createValidationRule( 'A', ValidationRule.OPERATOR_EQUAL, expressionA,
+        ValidationRule validationRuleA = createValidationRule( 'A', equal_to, expressionA,
             expressionB, periodType );
-        ValidationRule validationRuleB = createValidationRule( 'B', ValidationRule.OPERATOR_EQUAL, expressionA,
+        ValidationRule validationRuleB = createValidationRule( 'B', equal_to, expressionA,
             expressionB, periodType );
 
         int idA = validationRuleStore.saveValidationRule( validationRuleA );
@@ -203,9 +205,9 @@
     @Test
     public void testGetAllValidationRules()
     {
-        ValidationRule validationRuleA = createValidationRule( 'A', ValidationRule.OPERATOR_EQUAL, expressionA,
+        ValidationRule validationRuleA = createValidationRule( 'A', equal_to, expressionA,
             expressionB, periodType );
-        ValidationRule validationRuleB = createValidationRule( 'B', ValidationRule.OPERATOR_EQUAL, expressionA,
+        ValidationRule validationRuleB = createValidationRule( 'B', equal_to, expressionA,
             expressionB, periodType );
 
         validationRuleStore.saveValidationRule( validationRuleA );
@@ -221,9 +223,9 @@
     @Test
     public void testGetValidationRuleByName()
     {
-        ValidationRule validationRuleA = createValidationRule( 'A', ValidationRule.OPERATOR_EQUAL, expressionA,
+        ValidationRule validationRuleA = createValidationRule( 'A', equal_to, expressionA,
             expressionB, periodType );
-        ValidationRule validationRuleB = createValidationRule( 'B', ValidationRule.OPERATOR_EQUAL, expressionA,
+        ValidationRule validationRuleB = createValidationRule( 'B', equal_to, expressionA,
             expressionB, periodType );
 
         int id = validationRuleStore.saveValidationRule( validationRuleA );
@@ -234,7 +236,7 @@
         assertEquals( rule.getId(), id );
         assertEquals( rule.getName(), "ValidationRuleA" );
     }
-    
+
     @Test
     public void testGetValidationRulesByDataElements()
     {
@@ -247,41 +249,44 @@
         dataElementsB.add( dataElementD );
 
         Set<DataElement> dataElementsC = new HashSet<DataElement>();
-        
+
         Set<DataElement> dataElementsD = new HashSet<DataElement>();
         dataElementsD.addAll( dataElementsA );
-        dataElementsD.addAll( dataElementsB );        
-        
+        dataElementsD.addAll( dataElementsB );
+
         Expression expression1 = new Expression( "Expression1", "Expression1", dataElementsA );
         Expression expression2 = new Expression( "Expression2", "Expression2", dataElementsB );
         Expression expression3 = new Expression( "Expression3", "Expression3", dataElementsC );
-        
+
         expressionService.addExpression( expression1 );
         expressionService.addExpression( expression2 );
         expressionService.addExpression( expression3 );
-        
-        ValidationRule ruleA = createValidationRule( 'A', ValidationRule.OPERATOR_EQUAL, expression1, expression3, periodType );
-        ValidationRule ruleB = createValidationRule( 'B', ValidationRule.OPERATOR_EQUAL, expression2, expression3, periodType );
-        ValidationRule ruleC = createValidationRule( 'C', ValidationRule.OPERATOR_EQUAL, expression3, expression3, periodType );
+
+        ValidationRule ruleA = createValidationRule( 'A', equal_to, expression1, expression3,
+            periodType );
+        ValidationRule ruleB = createValidationRule( 'B', equal_to, expression2, expression3,
+            periodType );
+        ValidationRule ruleC = createValidationRule( 'C', equal_to, expression3, expression3,
+            periodType );
 
         validationRuleStore.saveValidationRule( ruleA );
         validationRuleStore.saveValidationRule( ruleB );
         validationRuleStore.saveValidationRule( ruleC );
-        
+
         Collection<ValidationRule> rules = validationRuleStore.getValidationRulesByDataElements( dataElementsA );
-        
+
         assertNotNull( rules );
         assertEquals( 1, rules.size() );
         assertTrue( rules.contains( ruleA ) );
 
         rules = validationRuleStore.getValidationRulesByDataElements( dataElementsB );
-        
+
         assertNotNull( rules );
         assertEquals( 1, rules.size() );
         assertTrue( rules.contains( ruleB ) );
 
         rules = validationRuleStore.getValidationRulesByDataElements( dataElementsD );
-        
+
         assertNotNull( rules );
         assertEquals( 2, rules.size() );
         assertTrue( rules.contains( ruleA ) );
@@ -300,27 +305,30 @@
         dataElementsB.add( dataElementD );
 
         Set<DataElement> dataElementsC = new HashSet<DataElement>();
-        
+
         Set<DataElement> dataElementsD = new HashSet<DataElement>();
         dataElementsD.addAll( dataElementsA );
-        dataElementsD.addAll( dataElementsB );        
-        
+        dataElementsD.addAll( dataElementsB );
+
         Expression expression1 = new Expression( "Expression1", "Expression1", dataElementsA );
         Expression expression2 = new Expression( "Expression2", "Expression2", dataElementsB );
         Expression expression3 = new Expression( "Expression3", "Expression3", dataElementsC );
-        
+
         expressionService.addExpression( expression1 );
         expressionService.addExpression( expression2 );
         expressionService.addExpression( expression3 );
-        
-        ValidationRule ruleA = createValidationRule( 'A', ValidationRule.OPERATOR_EQUAL, expression1, expression3, periodType );
-        ValidationRule ruleB = createValidationRule( 'B', ValidationRule.OPERATOR_EQUAL, expression2, expression3, periodType );
-        ValidationRule ruleC = createValidationRule( 'C', ValidationRule.OPERATOR_EQUAL, expression3, expression3, periodType );
+
+        ValidationRule ruleA = createValidationRule( 'A', equal_to, expression1, expression3,
+            periodType );
+        ValidationRule ruleB = createValidationRule( 'B', equal_to, expression2, expression3,
+            periodType );
+        ValidationRule ruleC = createValidationRule( 'C', equal_to, expression3, expression3,
+            periodType );
 
         validationRuleStore.saveValidationRule( ruleA );
         validationRuleStore.saveValidationRule( ruleB );
         validationRuleStore.saveValidationRule( ruleC );
-        
+
         assertNotNull( validationRuleStore.getNumberOfValidationRules().intValue() );
         assertEquals( 3, validationRuleStore.getNumberOfValidationRules().intValue() );
     }

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/ValidationRuleConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/ValidationRuleConverter.java	2010-12-09 05:53:20 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/ValidationRuleConverter.java	2010-12-29 10:06:33 +0000
@@ -34,6 +34,7 @@
 import org.amplecode.staxwax.writer.XMLWriter;
 import org.hisp.dhis.expression.Expression;
 import org.hisp.dhis.expression.ExpressionService;
+import org.hisp.dhis.expression.Operator;
 import org.hisp.dhis.importexport.ExportParams;
 import org.hisp.dhis.importexport.ImportObjectService;
 import org.hisp.dhis.importexport.ImportParams;
@@ -46,22 +47,31 @@
 
 /**
  * @author Lars Helge Overland
- * @version $Id: ValidationRuleConverter.java 6455 2008-11-24 08:59:37Z larshelg $
+ * @version $Id: ValidationRuleConverter.java 6455 2008-11-24 08:59:37Z larshelg
+ *          $
  */
 public class ValidationRuleConverter
     extends ValidationRuleImporter
     implements XMLConverter
 {
     public static final String COLLECTION_NAME = "validationRules";
+
     public static final String ELEMENT_NAME = "validationRule";
 
     private static final String FIELD_NAME = "name";
+
     private static final String FIELD_DESCRIPTION = "description";
+
     private static final String FIELD_TYPE = "type";
+
     private static final String FIELD_OPERATOR = "operator";
+
     private static final String FIELD_LEFTSIDE_EXPRESSION = "leftSideExpression";
+
     private static final String FIELD_LEFTSIDE_DESCRIPTION = "leftSideDescription";
+
     private static final String FIELD_RIGHTSIDE_EXPRESSION = "rightSideExpression";
+
     private static final String FIELD_RIGHTSIDE_DESCRIPTION = "rightSideDescription";
 
     // -------------------------------------------------------------------------
@@ -132,7 +142,7 @@
                 writer.writeElement( FIELD_NAME, rule.getName() );
                 writer.writeElement( FIELD_DESCRIPTION, rule.getDescription() );
                 writer.writeElement( FIELD_TYPE, rule.getType() );
-                writer.writeElement( FIELD_OPERATOR, rule.getOperator() );
+                writer.writeElement( FIELD_OPERATOR, rule.getOperator().toString() );
                 writer.writeElement( FIELD_LEFTSIDE_EXPRESSION, rule.getLeftSide().getExpression() );
                 writer.writeElement( FIELD_LEFTSIDE_DESCRIPTION, rule.getLeftSide().getDescription() );
                 writer.writeElement( FIELD_RIGHTSIDE_EXPRESSION, rule.getRightSide().getExpression() );
@@ -162,7 +172,7 @@
             validationRule.setName( values.get( FIELD_NAME ) );
             validationRule.setDescription( values.get( FIELD_DESCRIPTION ) );
             validationRule.setType( values.get( FIELD_TYPE ) );
-            validationRule.setOperator( values.get( FIELD_OPERATOR ) );
+            validationRule.setOperator( Operator.valueOf( values.get( FIELD_OPERATOR ) ) );
 
             validationRule.getLeftSide().setExpression(
                 expressionService.convertExpression( values.get( FIELD_LEFTSIDE_EXPRESSION ), dataElementMapping,

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/MathUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/MathUtils.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/MathUtils.java	2010-12-29 10:06:33 +0000
@@ -30,6 +30,7 @@
 import java.util.Random;
 import java.util.Scanner;
 
+import org.hisp.dhis.expression.Operator;
 import org.nfunk.jep.JEP;
 
 /**
@@ -50,9 +51,9 @@
      * @param rightSide The right side of the expression.
      * @return True if the expressio is true, fals otherwise.
      */
-    public static boolean expressionIsTrue( double leftSide, String operator, double rightSide )
+    public static boolean expressionIsTrue( double leftSide, Operator operator, double rightSide )
     {
-        final String expression = leftSide + operator + rightSide;
+        final String expression = leftSide + operator.getMathematicalOperator() + rightSide;
         
         final JEP parser = new JEP();
         

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/PDFUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/PDFUtils.java	2010-12-26 21:40:52 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/PDFUtils.java	2010-12-29 10:06:33 +0000
@@ -550,7 +550,7 @@
         table.addCell( getTextCell( i18n.getString( validationRule.getType() ) ) );
 
         table.addCell( getItalicCell( i18n.getString( "operator" ) ) );
-        table.addCell( getTextCell( i18n.getString( validationRule.getOperator() ) ) );
+        table.addCell( getTextCell( i18n.getString( validationRule.getOperator().toString() ) ) );
 
         table.addCell( getItalicCell( i18n.getString( "left_side_of_expression" ) ) );
         table.addCell( getTextCell( expressionService.getExpressionDescription( validationRule.getLeftSide()

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/MathUtilsTest.java'
--- dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/MathUtilsTest.java	2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/MathUtilsTest.java	2010-12-29 10:06:33 +0000
@@ -31,6 +31,7 @@
 import static junit.framework.Assert.assertFalse;
 import static junit.framework.Assert.assertTrue;
 import static org.hisp.dhis.system.util.MathUtils.expressionIsTrue;
+import static org.hisp.dhis.expression.Operator.*;
 
 import org.junit.Test;
 
@@ -40,23 +41,17 @@
  */
 public class MathUtilsTest
 {
-    private static final String OPERATOR_EQUAL = "==";
-    private static final String OPERATOR_NOT_EQUAL = "!=";
-    private static final String OPERATOR_GREATER = ">";
-    private static final String OPERATOR_GREATER_EQUAL = ">=";
-    private static final String OPERATOR_LESSER = "<";
-    private static final String OPERATOR_LESSER_EQUAL = "<=";
     
     @Test
     public void testExpressionIsTrue()
     {
-        assertFalse( expressionIsTrue( 20.0, OPERATOR_EQUAL, 10.0 ) );
-        assertTrue( expressionIsTrue( 20.0, OPERATOR_NOT_EQUAL, 10.0 ) );
-        assertTrue( expressionIsTrue( 20.0, OPERATOR_GREATER, 10.0 ) );
-        assertTrue( expressionIsTrue( 20.0, OPERATOR_GREATER_EQUAL, 20.0 ) );
-        assertFalse( expressionIsTrue( 30.0, OPERATOR_LESSER, 15.0 ) );
-        assertTrue( expressionIsTrue( 40.0, OPERATOR_LESSER_EQUAL, 50.0 ) );
-        assertFalse( expressionIsTrue( 0.0, OPERATOR_GREATER_EQUAL, 20.0 ) );
+        assertFalse( expressionIsTrue( 20.0, equal_to, 10.0 ) );
+        assertTrue( expressionIsTrue( 20.0, not_equal_to, 10.0 ) );
+        assertTrue( expressionIsTrue( 20.0, greater_than, 10.0 ) );
+        assertTrue( expressionIsTrue( 20.0, greater_than_or_equal_to, 20.0 ) );
+        assertFalse( expressionIsTrue( 30.0, less_than, 15.0 ) );
+        assertTrue( expressionIsTrue( 40.0, less_than_or_equal_to, 50.0 ) );
+        assertFalse( expressionIsTrue( 0.0, greater_than_or_equal_to, 20.0 ) );
     }
     
     @Test

=== modified file 'dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java'
--- dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java	2010-12-06 17:04:03 +0000
+++ dhis-2/dhis-support/dhis-support-test/src/main/java/org/hisp/dhis/DhisConvenienceTest.java	2010-12-29 10:06:33 +0000
@@ -61,6 +61,7 @@
 import org.hisp.dhis.datavalue.DataValueService;
 import org.hisp.dhis.expression.Expression;
 import org.hisp.dhis.expression.ExpressionService;
+import org.hisp.dhis.expression.Operator;
 import org.hisp.dhis.external.location.LocationManager;
 import org.hisp.dhis.importexport.ImportDataValue;
 import org.hisp.dhis.importexport.ImportObjectStatus;
@@ -728,7 +729,7 @@
      * @param rightSide The right side expression.
      * @param periodType The period-type.
      */
-    public static ValidationRule createValidationRule( char uniqueCharacter, String operator, Expression leftSide,
+    public static ValidationRule createValidationRule( char uniqueCharacter, Operator operator, Expression leftSide,
         Expression rightSide, PeriodType periodType )
     {
         ValidationRule validationRule = new ValidationRule();

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/AddValidationRuleAction.java'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/AddValidationRuleAction.java	2010-05-28 19:17:07 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/AddValidationRuleAction.java	2010-12-29 10:06:33 +0000
@@ -29,6 +29,7 @@
 
 import org.hisp.dhis.expression.Expression;
 import org.hisp.dhis.expression.ExpressionService;
+import org.hisp.dhis.expression.Operator;
 import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.validation.ValidationRule;
@@ -154,7 +155,7 @@
         validationRule.setName( name );
         validationRule.setDescription( description );
         validationRule.setType( ValidationRule.TYPE_ABSOLUTE );
-        validationRule.setOperator( operator );
+        validationRule.setOperator( Operator.valueOf(operator) );
         validationRule.setLeftSide( leftSide );
         validationRule.setRightSide( rightSide );
 

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/ExportValidationResultAction.java'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/ExportValidationResultAction.java	2010-12-27 00:21:07 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/ExportValidationResultAction.java	2010-12-29 10:06:33 +0000
@@ -134,7 +134,7 @@
             grid.addValue( format.formatPeriod( period ) );
             grid.addValue( validationResult.getValidationRule().getLeftSide().getDescription() ); //TODO lazy prone
             grid.addValue( String.valueOf( validationResult.getLeftsideValue() ) );
-            grid.addValue( i18n.getString( validationResult.getValidationRule().getOperator() ) );
+            grid.addValue( i18n.getString( validationResult.getValidationRule().getOperator().toString() ) );
             grid.addValue( String.valueOf( validationResult.getRightsideValue() ) );
             grid.addValue( validationResult.getValidationRule().getRightSide().getDescription() );
         }

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/GetValidationRuleAction.java'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/GetValidationRuleAction.java	2010-05-26 15:58:31 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/GetValidationRuleAction.java	2010-12-29 10:06:33 +0000
@@ -115,7 +115,7 @@
         leftSideTextualExpression = expressionService.getExpressionDescription( validationRule.getLeftSide().getExpression() );
         rightSideTextualExpression = expressionService.getExpressionDescription( validationRule.getRightSide().getExpression() );
         
-        validationOperator = validationRule.getOperator();       
+        validationOperator = validationRule.getOperator().toString();       
         
         periodType = validationRule.getPeriodType();
         

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/UpdateValidationRuleAction.java'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/UpdateValidationRuleAction.java	2010-05-28 19:17:07 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/UpdateValidationRuleAction.java	2010-12-29 10:06:33 +0000
@@ -28,6 +28,7 @@
  */
 
 import org.hisp.dhis.expression.ExpressionService;
+import org.hisp.dhis.expression.Operator;
 import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.validation.ValidationRule;
@@ -146,7 +147,7 @@
 
         validationRule.setName( name );
         validationRule.setDescription( description );
-        validationRule.setOperator( operator );
+        validationRule.setOperator( Operator.valueOf( operator ) );
 
         validationRule.getLeftSide().setExpression( leftSideExpression );
         validationRule.getLeftSide().setDescription( leftSideDescription );

=== modified file 'local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/meta/action/GenerateMetaDataReportResultAction.java'
--- local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/meta/action/GenerateMetaDataReportResultAction.java	2010-08-31 10:01:21 +0000
+++ local/in/dhis-web-reports-national/src/main/java/org/hisp/dhis/reports/meta/action/GenerateMetaDataReportResultAction.java	2010-12-29 10:06:33 +0000
@@ -1609,9 +1609,9 @@
                     sheet0.addCell( new Number( colStart, rowStart, validationRule.getId(), wCellformat ) );
                     sheet0.addCell( new Label( colStart + 1, rowStart, validationRule.getName(), wCellformat ) );
                     sheet0.addCell( new Label( colStart + 2, rowStart, validationRule.getDescription(), wCellformat ) );
-                    sheet0.addCell( new Label( colStart + 3, rowStart, validationRule.getMathematicalOperator(),
+                    sheet0.addCell( new Label( colStart + 3, rowStart, validationRule.getOperator().getMathematicalOperator(),
                         wCellformat ) );
-                    sheet0.addCell( new Label( colStart + 4, rowStart, validationRule.getOperator(), wCellformat ) );
+                    sheet0.addCell( new Label( colStart + 4, rowStart, validationRule.getOperator().toString(), wCellformat ) );
                     sheet0.addCell( new Label( colStart + 5, rowStart, validationRule.getType(), wCellformat ) );
                     sheet0.addCell( new Label( colStart + 6, rowStart, validationRule.getLeftSide().getDescription(),
                         wCellformat ) );
@@ -1742,9 +1742,9 @@
                         sheet0.addCell( new Label( colStart + 1, rowStart, validationRule.getName(), wCellformat ) );
                         sheet0
                             .addCell( new Label( colStart + 2, rowStart, validationRule.getDescription(), wCellformat ) );
-                        sheet0.addCell( new Label( colStart + 3, rowStart, validationRule.getMathematicalOperator(),
+                        sheet0.addCell( new Label( colStart + 3, rowStart, validationRule.getOperator().getMathematicalOperator(),
                             wCellformat ) );
-                        sheet0.addCell( new Label( colStart + 4, rowStart, validationRule.getOperator(), wCellformat ) );
+                        sheet0.addCell( new Label( colStart + 4, rowStart, validationRule.getOperator().toString(), wCellformat ) );
                         sheet0.addCell( new Label( colStart + 5, rowStart, validationRule.getType(), wCellformat ) );
                         sheet0.addCell( new Label( colStart + 6, rowStart, validationRule.getLeftSide()
                             .getDescription(), wCellformat ) );