← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20957: minor fix, use Object as argument parameters in Operators

 

------------------------------------------------------------
revno: 20957
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-11-05 10:55:41 +0700
message:
  minor fix, use Object as argument parameters in Operators
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/BetweenOperator.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/ContainsOperator.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/EqualOperator.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/GreaterEqualOperator.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/GreaterThanOperator.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/InOperator.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/LessEqualOperator.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/LessThanOperator.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/NotEqualOperator.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/Operator.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/query/operators/BetweenOperator.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/BetweenOperator.java	2015-11-04 09:45:59 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/BetweenOperator.java	2015-11-05 03:55:41 +0000
@@ -40,7 +40,7 @@
  */
 public class BetweenOperator extends Operator
 {
-    public BetweenOperator( String arg0, String arg1 )
+    public BetweenOperator( Object arg0, Object arg1 )
     {
         super( Typed.from( String.class, Number.class, Date.class ), arg0, arg1 );
     }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/ContainsOperator.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/ContainsOperator.java	2015-11-04 09:50:36 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/ContainsOperator.java	2015-11-05 03:55:41 +0000
@@ -40,7 +40,7 @@
 {
     private final boolean caseSensitive;
 
-    public ContainsOperator( String arg, boolean caseSensitive )
+    public ContainsOperator( Object arg, boolean caseSensitive )
     {
         super( Typed.from( String.class ), arg );
         this.caseSensitive = caseSensitive;
@@ -51,11 +51,11 @@
     {
         if ( caseSensitive )
         {
-            return Restrictions.like( propertyName, args.get( 0 ), MatchMode.ANYWHERE );
+            return Restrictions.like( propertyName, String.valueOf( args.get( 0 ) ), MatchMode.ANYWHERE );
         }
         else
         {
-            return Restrictions.ilike( propertyName, args.get( 0 ), MatchMode.ANYWHERE );
+            return Restrictions.ilike( propertyName, String.valueOf( args.get( 0 ) ), MatchMode.ANYWHERE );
         }
     }
 

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/EqualOperator.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/EqualOperator.java	2015-11-04 09:45:59 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/EqualOperator.java	2015-11-05 03:55:41 +0000
@@ -40,7 +40,7 @@
  */
 public class EqualOperator extends Operator
 {
-    public EqualOperator( String arg )
+    public EqualOperator( Object arg )
     {
         super( Typed.from( String.class, Boolean.class, Number.class, Date.class, Enum.class ), arg );
     }
@@ -103,7 +103,7 @@
         }
         else if ( Enum.class.isInstance( value ) )
         {
-            String s1 = args.get( 0 );
+            String s1 = String.valueOf( args.get( 0 ) );
             String s2 = String.valueOf( value );
 
             return s2.equals( s1 );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/GreaterEqualOperator.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/GreaterEqualOperator.java	2015-11-04 09:45:59 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/GreaterEqualOperator.java	2015-11-05 03:55:41 +0000
@@ -40,7 +40,7 @@
  */
 public class GreaterEqualOperator extends Operator
 {
-    public GreaterEqualOperator( String arg )
+    public GreaterEqualOperator( Object arg )
     {
         super( Typed.from( String.class, Boolean.class, Number.class, Date.class ), arg );
     }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/GreaterThanOperator.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/GreaterThanOperator.java	2015-11-04 09:45:59 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/GreaterThanOperator.java	2015-11-05 03:55:41 +0000
@@ -40,7 +40,7 @@
  */
 public class GreaterThanOperator extends Operator
 {
-    public GreaterThanOperator( String arg )
+    public GreaterThanOperator( Object arg )
     {
         super( Typed.from( String.class, Boolean.class, Number.class, Date.class ), arg );
     }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/InOperator.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/InOperator.java	2015-11-04 09:45:59 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/InOperator.java	2015-11-05 03:55:41 +0000
@@ -40,7 +40,7 @@
  */
 public class InOperator extends Operator
 {
-    public InOperator( String arg )
+    public InOperator( Object arg )
     {
         super( Typed.from( String.class, Boolean.class, Number.class, Date.class, Enum.class ), arg );
     }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/LessEqualOperator.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/LessEqualOperator.java	2015-11-04 09:45:59 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/LessEqualOperator.java	2015-11-05 03:55:41 +0000
@@ -40,7 +40,7 @@
  */
 public class LessEqualOperator extends Operator
 {
-    public LessEqualOperator( String arg )
+    public LessEqualOperator( Object arg )
     {
         super( Typed.from( String.class, Boolean.class, Number.class, Date.class ), arg );
     }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/LessThanOperator.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/LessThanOperator.java	2015-11-04 09:45:59 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/LessThanOperator.java	2015-11-05 03:55:41 +0000
@@ -40,7 +40,7 @@
  */
 public class LessThanOperator extends Operator
 {
-    public LessThanOperator( String arg )
+    public LessThanOperator( Object arg )
     {
         super( Typed.from( String.class, Boolean.class, Number.class, Date.class ), arg );
     }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/NotEqualOperator.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/NotEqualOperator.java	2015-11-04 09:45:59 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/NotEqualOperator.java	2015-11-05 03:55:41 +0000
@@ -36,9 +36,9 @@
  */
 public class NotEqualOperator extends EqualOperator
 {
-    public NotEqualOperator( String propertyValue )
+    public NotEqualOperator( Object arg )
     {
-        super( propertyValue );
+        super( arg );
     }
 
     @Override

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/Operator.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/Operator.java	2015-11-04 09:45:59 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/Operator.java	2015-11-05 03:55:41 +0000
@@ -41,7 +41,7 @@
  */
 public abstract class Operator
 {
-    protected final List<String> args = new ArrayList<>();
+    protected final List<Object> args = new ArrayList<>();
 
     protected final Typed typed;
 
@@ -50,13 +50,13 @@
         this.typed = typed;
     }
 
-    public Operator( Typed typed, String arg )
+    public Operator( Typed typed, Object arg )
     {
         this.typed = typed;
         this.args.add( arg );
     }
 
-    public Operator( Typed typed, String... args )
+    public Operator( Typed typed, Object... args )
     {
         this.typed = typed;
         Collections.addAll( this.args, args );