------------------------------------------------------------ revno: 20948 committer: Morten Olav Hansen <morte...@gmail.com> branch nick: dhis2 timestamp: Wed 2015-11-04 15:43:27 +0700 message: minor rename removed: dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/Between.java dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/Equal.java dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/GreaterEqual.java dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/GreaterThan.java dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/ILike.java dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/In.java dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/LessEqual.java dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/LessThan.java dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/Like.java dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/NotEqual.java dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/NotNull.java dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/Null.java added: 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/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/ILikeOperator.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/LikeOperator.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/NotNullOperator.java dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/NullOperator.java modified: dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/query/OperatorTest.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
=== removed file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/Between.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/Between.java 2015-11-04 07:52:45 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/Between.java 1970-01-01 00:00:00 +0000 @@ -1,81 +0,0 @@ -package org.hisp.dhis.query.operators; - -/* - * Copyright (c) 2004-2015, 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 org.hisp.dhis.query.Typed; - -import java.util.Collection; -import java.util.Date; - -/** - * @author Morten Olav Hansen <morte...@gmail.com> - */ -public class Between extends Operator -{ - public Between( String arg0, String arg1 ) - { - super( Typed.from( String.class, Number.class, Date.class ), arg0, arg1 ); - } - - @Override - public boolean test( Object value ) - { - if ( args.isEmpty() || value == null ) - { - return false; - } - - if ( Integer.class.isInstance( value ) ) - { - Integer s1 = getValue( Integer.class, value ); - Integer min = getValue( Integer.class, 0 ); - Integer max = getValue( Integer.class, 1 ); - - return s1 >= min && s1 <= max; - } - else if ( Float.class.isInstance( value ) ) - { - Float s1 = getValue( Float.class, value ); - Integer min = getValue( Integer.class, 0 ); - Integer max = getValue( Integer.class, 1 ); - - return s1 >= min && s1 <= max; - } - else if ( Collection.class.isInstance( value ) ) - { - Collection<?> collection = (Collection<?>) value; - Integer min = getValue( Integer.class, 0 ); - Integer max = getValue( Integer.class, 1 ); - - return collection.size() >= min && collection.size() <= max; - } - - return false; - } -} === added 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 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/BetweenOperator.java 2015-11-04 08:43:27 +0000 @@ -0,0 +1,81 @@ +package org.hisp.dhis.query.operators; + +/* + * Copyright (c) 2004-2015, 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 org.hisp.dhis.query.Typed; + +import java.util.Collection; +import java.util.Date; + +/** + * @author Morten Olav Hansen <morte...@gmail.com> + */ +public class BetweenOperator extends Operator +{ + public BetweenOperator( String arg0, String arg1 ) + { + super( Typed.from( String.class, Number.class, Date.class ), arg0, arg1 ); + } + + @Override + public boolean test( Object value ) + { + if ( args.isEmpty() || value == null ) + { + return false; + } + + if ( Integer.class.isInstance( value ) ) + { + Integer s1 = getValue( Integer.class, value ); + Integer min = getValue( Integer.class, 0 ); + Integer max = getValue( Integer.class, 1 ); + + return s1 >= min && s1 <= max; + } + else if ( Float.class.isInstance( value ) ) + { + Float s1 = getValue( Float.class, value ); + Integer min = getValue( Integer.class, 0 ); + Integer max = getValue( Integer.class, 1 ); + + return s1 >= min && s1 <= max; + } + else if ( Collection.class.isInstance( value ) ) + { + Collection<?> collection = (Collection<?>) value; + Integer min = getValue( Integer.class, 0 ); + Integer max = getValue( Integer.class, 1 ); + + return collection.size() >= min && collection.size() <= max; + } + + return false; + } +} === removed file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/Equal.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/Equal.java 2015-11-04 06:46:21 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/Equal.java 1970-01-01 00:00:00 +0000 @@ -1,106 +0,0 @@ -package org.hisp.dhis.query.operators; - -/* - * Copyright (c) 2004-2015, 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 org.hisp.dhis.query.Typed; - -import java.util.Collection; -import java.util.Date; - -/** - * @author Morten Olav Hansen <morte...@gmail.com> - */ -public class Equal extends Operator -{ - public Equal( String arg ) - { - super( Typed.from( String.class, Boolean.class, Number.class, Date.class ), arg ); - } - - @Override - public boolean test( Object value ) - { - if ( args.isEmpty() || value == null ) - { - return false; - } - - if ( String.class.isInstance( value ) ) - { - String s1 = getValue( String.class ); - String s2 = (String) value; - - return s1 != null && s2.equals( s1 ); - } - else if ( Boolean.class.isInstance( value ) ) - { - Boolean s1 = getValue( Boolean.class ); - Boolean s2 = (Boolean) value; - - return s1 != null && s2.equals( s1 ); - } - else if ( Integer.class.isInstance( value ) ) - { - Integer s1 = getValue( Integer.class ); - Integer s2 = (Integer) value; - - return s1 != null && s2.equals( s1 ); - } - else if ( Float.class.isInstance( value ) ) - { - Float s1 = getValue( Float.class ); - Float s2 = (Float) value; - - return s1 != null && s2.equals( s1 ); - } - else if ( Collection.class.isInstance( value ) ) - { - Collection<?> collection = (Collection<?>) value; - Integer size = getValue( Integer.class ); - - return size != null && collection.size() == size; - } - else if ( Date.class.isInstance( value ) ) - { - Date s1 = getValue( Date.class ); - Date s2 = (Date) value; - - return s1 != null && s2.equals( s1 ); - } - else if ( Enum.class.isInstance( value ) ) - { - String s1 = args.get( 0 ); - String s2 = String.valueOf( value ); - - return s2.equals( s1 ); - } - - return false; - } -} === added 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 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/EqualOperator.java 2015-11-04 08:43:27 +0000 @@ -0,0 +1,106 @@ +package org.hisp.dhis.query.operators; + +/* + * Copyright (c) 2004-2015, 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 org.hisp.dhis.query.Typed; + +import java.util.Collection; +import java.util.Date; + +/** + * @author Morten Olav Hansen <morte...@gmail.com> + */ +public class EqualOperator extends Operator +{ + public EqualOperator( String arg ) + { + super( Typed.from( String.class, Boolean.class, Number.class, Date.class ), arg ); + } + + @Override + public boolean test( Object value ) + { + if ( args.isEmpty() || value == null ) + { + return false; + } + + if ( String.class.isInstance( value ) ) + { + String s1 = getValue( String.class ); + String s2 = (String) value; + + return s1 != null && s2.equals( s1 ); + } + else if ( Boolean.class.isInstance( value ) ) + { + Boolean s1 = getValue( Boolean.class ); + Boolean s2 = (Boolean) value; + + return s1 != null && s2.equals( s1 ); + } + else if ( Integer.class.isInstance( value ) ) + { + Integer s1 = getValue( Integer.class ); + Integer s2 = (Integer) value; + + return s1 != null && s2.equals( s1 ); + } + else if ( Float.class.isInstance( value ) ) + { + Float s1 = getValue( Float.class ); + Float s2 = (Float) value; + + return s1 != null && s2.equals( s1 ); + } + else if ( Collection.class.isInstance( value ) ) + { + Collection<?> collection = (Collection<?>) value; + Integer size = getValue( Integer.class ); + + return size != null && collection.size() == size; + } + else if ( Date.class.isInstance( value ) ) + { + Date s1 = getValue( Date.class ); + Date s2 = (Date) value; + + return s1 != null && s2.equals( s1 ); + } + else if ( Enum.class.isInstance( value ) ) + { + String s1 = args.get( 0 ); + String s2 = String.valueOf( value ); + + return s2.equals( s1 ); + } + + return false; + } +} === removed file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/GreaterEqual.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/GreaterEqual.java 2015-11-04 06:46:21 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/GreaterEqual.java 1970-01-01 00:00:00 +0000 @@ -1,85 +0,0 @@ -package org.hisp.dhis.query.operators; - -/* - * Copyright (c) 2004-2015, 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 org.hisp.dhis.query.Typed; - -import java.util.Collection; -import java.util.Date; - -/** - * @author Morten Olav Hansen <morte...@gmail.com> - */ -public class GreaterEqual extends Operator -{ - public GreaterEqual( String arg ) - { - super( Typed.from( String.class, Boolean.class, Number.class, Date.class ), arg ); - } - - @Override - public boolean test( Object value ) - { - if ( args.isEmpty() || value == null ) - { - return false; - } - - if ( Integer.class.isInstance( value ) ) - { - Integer s1 = getValue( Integer.class ); - Integer s2 = (Integer) value; - - return s1 != null && s2 >= s1; - } - else if ( Float.class.isInstance( value ) ) - { - Float s1 = getValue( Float.class ); - Float s2 = (Float) value; - - return s1 != null && s2 >= s1; - } - else if ( Collection.class.isInstance( value ) ) - { - Collection<?> collection = (Collection<?>) value; - Integer size = getValue( Integer.class ); - - return size != null && collection.size() >= size; - } - else if ( Date.class.isInstance( value ) ) - { - Date s1 = getValue( Date.class ); - Date s2 = (Date) value; - - return s1 != null && (s2.after( s1 ) || s2.equals( s1 )); - } - - return false; - } -} === added 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 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/GreaterEqualOperator.java 2015-11-04 08:43:27 +0000 @@ -0,0 +1,85 @@ +package org.hisp.dhis.query.operators; + +/* + * Copyright (c) 2004-2015, 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 org.hisp.dhis.query.Typed; + +import java.util.Collection; +import java.util.Date; + +/** + * @author Morten Olav Hansen <morte...@gmail.com> + */ +public class GreaterEqualOperator extends Operator +{ + public GreaterEqualOperator( String arg ) + { + super( Typed.from( String.class, Boolean.class, Number.class, Date.class ), arg ); + } + + @Override + public boolean test( Object value ) + { + if ( args.isEmpty() || value == null ) + { + return false; + } + + if ( Integer.class.isInstance( value ) ) + { + Integer s1 = getValue( Integer.class ); + Integer s2 = (Integer) value; + + return s1 != null && s2 >= s1; + } + else if ( Float.class.isInstance( value ) ) + { + Float s1 = getValue( Float.class ); + Float s2 = (Float) value; + + return s1 != null && s2 >= s1; + } + else if ( Collection.class.isInstance( value ) ) + { + Collection<?> collection = (Collection<?>) value; + Integer size = getValue( Integer.class ); + + return size != null && collection.size() >= size; + } + else if ( Date.class.isInstance( value ) ) + { + Date s1 = getValue( Date.class ); + Date s2 = (Date) value; + + return s1 != null && (s2.after( s1 ) || s2.equals( s1 )); + } + + return false; + } +} === removed file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/GreaterThan.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/GreaterThan.java 2015-11-04 06:46:21 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/GreaterThan.java 1970-01-01 00:00:00 +0000 @@ -1,85 +0,0 @@ -package org.hisp.dhis.query.operators; - -/* - * Copyright (c) 2004-2015, 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 org.hisp.dhis.query.Typed; - -import java.util.Collection; -import java.util.Date; - -/** - * @author Morten Olav Hansen <morte...@gmail.com> - */ -public class GreaterThan extends Operator -{ - public GreaterThan( String arg ) - { - super( Typed.from( String.class, Boolean.class, Number.class, Date.class ), arg ); - } - - @Override - public boolean test( Object value ) - { - if ( args.isEmpty() || value == null ) - { - return false; - } - - if ( Integer.class.isInstance( value ) ) - { - Integer s1 = getValue( Integer.class ); - Integer s2 = (Integer) value; - - return s1 != null && s2 > s1; - } - else if ( Float.class.isInstance( value ) ) - { - Float s1 = getValue( Float.class ); - Float s2 = (Float) value; - - return s1 != null && s2 > s1; - } - else if ( Collection.class.isInstance( value ) ) - { - Collection<?> collection = (Collection<?>) value; - Integer size = getValue( Integer.class ); - - return size != null && collection.size() > size; - } - else if ( Date.class.isInstance( value ) ) - { - Date s1 = getValue( Date.class ); - Date s2 = (Date) value; - - return s1 != null && s2.after( s1 ); - } - - return false; - } -} === added 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 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/GreaterThanOperator.java 2015-11-04 08:43:27 +0000 @@ -0,0 +1,85 @@ +package org.hisp.dhis.query.operators; + +/* + * Copyright (c) 2004-2015, 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 org.hisp.dhis.query.Typed; + +import java.util.Collection; +import java.util.Date; + +/** + * @author Morten Olav Hansen <morte...@gmail.com> + */ +public class GreaterThanOperator extends Operator +{ + public GreaterThanOperator( String arg ) + { + super( Typed.from( String.class, Boolean.class, Number.class, Date.class ), arg ); + } + + @Override + public boolean test( Object value ) + { + if ( args.isEmpty() || value == null ) + { + return false; + } + + if ( Integer.class.isInstance( value ) ) + { + Integer s1 = getValue( Integer.class ); + Integer s2 = (Integer) value; + + return s1 != null && s2 > s1; + } + else if ( Float.class.isInstance( value ) ) + { + Float s1 = getValue( Float.class ); + Float s2 = (Float) value; + + return s1 != null && s2 > s1; + } + else if ( Collection.class.isInstance( value ) ) + { + Collection<?> collection = (Collection<?>) value; + Integer size = getValue( Integer.class ); + + return size != null && collection.size() > size; + } + else if ( Date.class.isInstance( value ) ) + { + Date s1 = getValue( Date.class ); + Date s2 = (Date) value; + + return s1 != null && s2.after( s1 ); + } + + return false; + } +} === removed file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/ILike.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/ILike.java 2015-11-04 06:46:21 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/ILike.java 1970-01-01 00:00:00 +0000 @@ -1,61 +0,0 @@ -package org.hisp.dhis.query.operators; - -/* - * Copyright (c) 2004-2015, 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 org.hisp.dhis.query.Typed; - -/** - * @author Morten Olav Hansen <morte...@gmail.com> - */ -public class ILike extends Operator -{ - public ILike( String arg ) - { - super( Typed.from( String.class ), arg ); - } - - @Override - public boolean test( Object value ) - { - if ( args.isEmpty() || value == null ) - { - return false; - } - - if ( String.class.isInstance( value ) ) - { - String s1 = getValue( String.class ); - String s2 = (String) value; - - return s1 != null && s2.toLowerCase().contains( s1.toLowerCase() ); - } - - return false; - } -} === added file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/ILikeOperator.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/ILikeOperator.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/ILikeOperator.java 2015-11-04 08:43:27 +0000 @@ -0,0 +1,61 @@ +package org.hisp.dhis.query.operators; + +/* + * Copyright (c) 2004-2015, 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 org.hisp.dhis.query.Typed; + +/** + * @author Morten Olav Hansen <morte...@gmail.com> + */ +public class ILikeOperator extends Operator +{ + public ILikeOperator( String arg ) + { + super( Typed.from( String.class ), arg ); + } + + @Override + public boolean test( Object value ) + { + if ( args.isEmpty() || value == null ) + { + return false; + } + + if ( String.class.isInstance( value ) ) + { + String s1 = getValue( String.class ); + String s2 = (String) value; + + return s1 != null && s2.toLowerCase().contains( s1.toLowerCase() ); + } + + return false; + } +} === removed file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/In.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/In.java 2015-11-04 08:29:32 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/In.java 1970-01-01 00:00:00 +0000 @@ -1,114 +0,0 @@ -package org.hisp.dhis.query.operators; - -/* - * Copyright (c) 2004-2015, 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 org.hisp.dhis.query.Typed; - -import java.util.Collection; -import java.util.Date; - -/** - * @author Morten Olav Hansen <morte...@gmail.com> - */ -public class In extends Operator -{ - public In( String arg ) - { - super( Typed.from( String.class, Boolean.class, Number.class, Date.class, Enum.class ), arg ); - } - - @Override - @SuppressWarnings( "unchecked" ) - public boolean test( Object value ) - { - Collection<String> items = getValue( Collection.class ); - - if ( items == null || value == null ) - { - return false; - } - - for ( String item : items ) - { - if ( compare( item, value ) ) - { - return true; - } - } - - return false; - } - - private boolean compare( String item, Object object ) - { - if ( String.class.isInstance( object ) ) - { - String s1 = getValue( String.class, item ); - String s2 = (String) object; - - return s1 != null && s2.equals( s1 ); - } - else if ( Boolean.class.isInstance( object ) ) - { - Boolean s1 = getValue( Boolean.class, item ); - Boolean s2 = (Boolean) object; - - return s1 != null && s2.equals( s1 ); - } - else if ( Integer.class.isInstance( object ) ) - { - Integer s1 = getValue( Integer.class, item ); - Integer s2 = (Integer) object; - - return s1 != null && s2.equals( s1 ); - } - else if ( Float.class.isInstance( object ) ) - { - Float s1 = getValue( Float.class, item ); - Float s2 = (Float) object; - - return s1 != null && s2.equals( s1 ); - } - else if ( Date.class.isInstance( object ) ) - { - Date s1 = getValue( Date.class, item ); - Date s2 = (Date) object; - - return s1 != null && s2.equals( s1 ); - } - else if ( Enum.class.isInstance( object ) ) - { - String s2 = String.valueOf( object ); - - return item != null && s2.equals( item ); - } - - return false; - } -} === added 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 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/InOperator.java 2015-11-04 08:43:27 +0000 @@ -0,0 +1,114 @@ +package org.hisp.dhis.query.operators; + +/* + * Copyright (c) 2004-2015, 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 org.hisp.dhis.query.Typed; + +import java.util.Collection; +import java.util.Date; + +/** + * @author Morten Olav Hansen <morte...@gmail.com> + */ +public class InOperator extends Operator +{ + public InOperator( String arg ) + { + super( Typed.from( String.class, Boolean.class, Number.class, Date.class, Enum.class ), arg ); + } + + @Override + @SuppressWarnings( "unchecked" ) + public boolean test( Object value ) + { + Collection<String> items = getValue( Collection.class ); + + if ( items == null || value == null ) + { + return false; + } + + for ( String item : items ) + { + if ( compare( item, value ) ) + { + return true; + } + } + + return false; + } + + private boolean compare( String item, Object object ) + { + if ( String.class.isInstance( object ) ) + { + String s1 = getValue( String.class, item ); + String s2 = (String) object; + + return s1 != null && s2.equals( s1 ); + } + else if ( Boolean.class.isInstance( object ) ) + { + Boolean s1 = getValue( Boolean.class, item ); + Boolean s2 = (Boolean) object; + + return s1 != null && s2.equals( s1 ); + } + else if ( Integer.class.isInstance( object ) ) + { + Integer s1 = getValue( Integer.class, item ); + Integer s2 = (Integer) object; + + return s1 != null && s2.equals( s1 ); + } + else if ( Float.class.isInstance( object ) ) + { + Float s1 = getValue( Float.class, item ); + Float s2 = (Float) object; + + return s1 != null && s2.equals( s1 ); + } + else if ( Date.class.isInstance( object ) ) + { + Date s1 = getValue( Date.class, item ); + Date s2 = (Date) object; + + return s1 != null && s2.equals( s1 ); + } + else if ( Enum.class.isInstance( object ) ) + { + String s2 = String.valueOf( object ); + + return item != null && s2.equals( item ); + } + + return false; + } +} === removed file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/LessEqual.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/LessEqual.java 2015-11-04 06:46:21 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/LessEqual.java 1970-01-01 00:00:00 +0000 @@ -1,85 +0,0 @@ -package org.hisp.dhis.query.operators; - -/* - * Copyright (c) 2004-2015, 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 org.hisp.dhis.query.Typed; - -import java.util.Collection; -import java.util.Date; - -/** - * @author Morten Olav Hansen <morte...@gmail.com> - */ -public class LessEqual extends Operator -{ - public LessEqual( String arg ) - { - super( Typed.from( String.class, Boolean.class, Number.class, Date.class ), arg ); - } - - @Override - public boolean test( Object value ) - { - if ( args.isEmpty() || value == null ) - { - return false; - } - - if ( Integer.class.isInstance( value ) ) - { - Integer s1 = getValue( Integer.class ); - Integer s2 = (Integer) value; - - return s1 != null && s2 <= s1; - } - else if ( Float.class.isInstance( value ) ) - { - Float s1 = getValue( Float.class ); - Float s2 = (Float) value; - - return s1 != null && s2 <= s1; - } - else if ( Collection.class.isInstance( value ) ) - { - Collection<?> collection = (Collection<?>) value; - Integer size = getValue( Integer.class ); - - return size != null && collection.size() <= size; - } - else if ( Date.class.isInstance( value ) ) - { - Date s1 = getValue( Date.class ); - Date s2 = (Date) value; - - return s1 != null && (s2.before( s1 ) || s2.equals( s1 )); - } - - return false; - } -} === added 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 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/LessEqualOperator.java 2015-11-04 08:43:27 +0000 @@ -0,0 +1,85 @@ +package org.hisp.dhis.query.operators; + +/* + * Copyright (c) 2004-2015, 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 org.hisp.dhis.query.Typed; + +import java.util.Collection; +import java.util.Date; + +/** + * @author Morten Olav Hansen <morte...@gmail.com> + */ +public class LessEqualOperator extends Operator +{ + public LessEqualOperator( String arg ) + { + super( Typed.from( String.class, Boolean.class, Number.class, Date.class ), arg ); + } + + @Override + public boolean test( Object value ) + { + if ( args.isEmpty() || value == null ) + { + return false; + } + + if ( Integer.class.isInstance( value ) ) + { + Integer s1 = getValue( Integer.class ); + Integer s2 = (Integer) value; + + return s1 != null && s2 <= s1; + } + else if ( Float.class.isInstance( value ) ) + { + Float s1 = getValue( Float.class ); + Float s2 = (Float) value; + + return s1 != null && s2 <= s1; + } + else if ( Collection.class.isInstance( value ) ) + { + Collection<?> collection = (Collection<?>) value; + Integer size = getValue( Integer.class ); + + return size != null && collection.size() <= size; + } + else if ( Date.class.isInstance( value ) ) + { + Date s1 = getValue( Date.class ); + Date s2 = (Date) value; + + return s1 != null && (s2.before( s1 ) || s2.equals( s1 )); + } + + return false; + } +} === removed file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/LessThan.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/LessThan.java 2015-11-04 06:46:21 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/LessThan.java 1970-01-01 00:00:00 +0000 @@ -1,85 +0,0 @@ -package org.hisp.dhis.query.operators; - -/* - * Copyright (c) 2004-2015, 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 org.hisp.dhis.query.Typed; - -import java.util.Collection; -import java.util.Date; - -/** - * @author Morten Olav Hansen <morte...@gmail.com> - */ -public class LessThan extends Operator -{ - public LessThan( String arg ) - { - super( Typed.from( String.class, Boolean.class, Number.class, Date.class ), arg ); - } - - @Override - public boolean test( Object value ) - { - if ( args.isEmpty() || value == null ) - { - return false; - } - - if ( Integer.class.isInstance( value ) ) - { - Integer s1 = getValue( Integer.class ); - Integer s2 = (Integer) value; - - return s1 != null && s2 < s1; - } - else if ( Float.class.isInstance( value ) ) - { - Float s1 = getValue( Float.class ); - Float s2 = (Float) value; - - return s1 != null && s2 < s1; - } - else if ( Collection.class.isInstance( value ) ) - { - Collection<?> collection = (Collection<?>) value; - Integer size = getValue( Integer.class ); - - return size != null && collection.size() < size; - } - else if ( Date.class.isInstance( value ) ) - { - Date s1 = getValue( Date.class ); - Date s2 = (Date) value; - - return s1 != null && (s2.before( s1 )); - } - - return false; - } -} === added 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 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/LessThanOperator.java 2015-11-04 08:43:27 +0000 @@ -0,0 +1,85 @@ +package org.hisp.dhis.query.operators; + +/* + * Copyright (c) 2004-2015, 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 org.hisp.dhis.query.Typed; + +import java.util.Collection; +import java.util.Date; + +/** + * @author Morten Olav Hansen <morte...@gmail.com> + */ +public class LessThanOperator extends Operator +{ + public LessThanOperator( String arg ) + { + super( Typed.from( String.class, Boolean.class, Number.class, Date.class ), arg ); + } + + @Override + public boolean test( Object value ) + { + if ( args.isEmpty() || value == null ) + { + return false; + } + + if ( Integer.class.isInstance( value ) ) + { + Integer s1 = getValue( Integer.class ); + Integer s2 = (Integer) value; + + return s1 != null && s2 < s1; + } + else if ( Float.class.isInstance( value ) ) + { + Float s1 = getValue( Float.class ); + Float s2 = (Float) value; + + return s1 != null && s2 < s1; + } + else if ( Collection.class.isInstance( value ) ) + { + Collection<?> collection = (Collection<?>) value; + Integer size = getValue( Integer.class ); + + return size != null && collection.size() < size; + } + else if ( Date.class.isInstance( value ) ) + { + Date s1 = getValue( Date.class ); + Date s2 = (Date) value; + + return s1 != null && (s2.before( s1 )); + } + + return false; + } +} === removed file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/Like.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/Like.java 2015-11-04 06:46:21 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/Like.java 1970-01-01 00:00:00 +0000 @@ -1,61 +0,0 @@ -package org.hisp.dhis.query.operators; - -/* - * Copyright (c) 2004-2015, 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 org.hisp.dhis.query.Typed; - -/** - * @author Morten Olav Hansen <morte...@gmail.com> - */ -public class Like extends Operator -{ - public Like( String arg ) - { - super( Typed.from( String.class ), arg ); - } - - @Override - public boolean test( Object value ) - { - if ( args.isEmpty() || value == null ) - { - return false; - } - - if ( String.class.isInstance( value ) ) - { - String s1 = getValue( String.class ); - String s2 = (String) value; - - return s1 != null && s2.contains( s1 ); - } - - return false; - } -} === added file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/LikeOperator.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/LikeOperator.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/LikeOperator.java 2015-11-04 08:43:27 +0000 @@ -0,0 +1,61 @@ +package org.hisp.dhis.query.operators; + +/* + * Copyright (c) 2004-2015, 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 org.hisp.dhis.query.Typed; + +/** + * @author Morten Olav Hansen <morte...@gmail.com> + */ +public class LikeOperator extends Operator +{ + public LikeOperator( String arg ) + { + super( Typed.from( String.class ), arg ); + } + + @Override + public boolean test( Object value ) + { + if ( args.isEmpty() || value == null ) + { + return false; + } + + if ( String.class.isInstance( value ) ) + { + String s1 = getValue( String.class ); + String s2 = (String) value; + + return s1 != null && s2.contains( s1 ); + } + + return false; + } +} === removed file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/NotEqual.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/NotEqual.java 2015-11-04 05:48:42 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/NotEqual.java 1970-01-01 00:00:00 +0000 @@ -1,46 +0,0 @@ -package org.hisp.dhis.query.operators; - -/* - * Copyright (c) 2004-2015, 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. - */ - -/** - * @author Morten Olav Hansen <morte...@gmail.com> - */ -public class NotEqual extends Equal -{ - public NotEqual( String propertyValue ) - { - super( propertyValue ); - } - - @Override - public boolean test( Object value ) - { - return !super.test( value ); - } -} === added 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 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/NotEqualOperator.java 2015-11-04 08:43:27 +0000 @@ -0,0 +1,46 @@ +package org.hisp.dhis.query.operators; + +/* + * Copyright (c) 2004-2015, 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. + */ + +/** + * @author Morten Olav Hansen <morte...@gmail.com> + */ +public class NotEqualOperator extends EqualOperator +{ + public NotEqualOperator( String propertyValue ) + { + super( propertyValue ); + } + + @Override + public boolean test( Object value ) + { + return !super.test( value ); + } +} === removed file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/NotNull.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/NotNull.java 2015-11-04 06:46:21 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/NotNull.java 1970-01-01 00:00:00 +0000 @@ -1,50 +0,0 @@ -package org.hisp.dhis.query.operators; - -/* - * Copyright (c) 2004-2015, 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 org.hisp.dhis.query.Typed; - -import java.util.Date; - -/** - * @author Morten Olav Hansen <morte...@gmail.com> - */ -public class NotNull extends Operator -{ - public NotNull() - { - super( Typed.from( String.class, Boolean.class, Number.class, Date.class ) ); - } - - @Override - public boolean test( Object value ) - { - return value != null; - } -} === added file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/NotNullOperator.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/NotNullOperator.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/NotNullOperator.java 2015-11-04 08:43:27 +0000 @@ -0,0 +1,50 @@ +package org.hisp.dhis.query.operators; + +/* + * Copyright (c) 2004-2015, 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 org.hisp.dhis.query.Typed; + +import java.util.Date; + +/** + * @author Morten Olav Hansen <morte...@gmail.com> + */ +public class NotNullOperator extends Operator +{ + public NotNullOperator() + { + super( Typed.from( String.class, Boolean.class, Number.class, Date.class ) ); + } + + @Override + public boolean test( Object value ) + { + return value != null; + } +} === removed file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/Null.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/Null.java 2015-11-04 06:46:21 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/Null.java 1970-01-01 00:00:00 +0000 @@ -1,50 +0,0 @@ -package org.hisp.dhis.query.operators; - -/* - * Copyright (c) 2004-2015, 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 org.hisp.dhis.query.Typed; - -import java.util.Date; - -/** - * @author Morten Olav Hansen <morte...@gmail.com> - */ -public class Null extends Operator -{ - public Null() - { - super( Typed.from( String.class, Boolean.class, Number.class, Date.class ) ); - } - - @Override - public boolean test( Object value ) - { - return value == null; - } -} === added file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/NullOperator.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/NullOperator.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/operators/NullOperator.java 2015-11-04 08:43:27 +0000 @@ -0,0 +1,50 @@ +package org.hisp.dhis.query.operators; + +/* + * Copyright (c) 2004-2015, 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 org.hisp.dhis.query.Typed; + +import java.util.Date; + +/** + * @author Morten Olav Hansen <morte...@gmail.com> + */ +public class NullOperator extends Operator +{ + public NullOperator() + { + super( Typed.from( String.class, Boolean.class, Number.class, Date.class ) ); + } + + @Override + public boolean test( Object value ) + { + return value == null; + } +} === modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/query/OperatorTest.java' --- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/query/OperatorTest.java 2015-11-04 08:35:57 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/query/OperatorTest.java 2015-11-04 08:43:27 +0000 @@ -28,18 +28,18 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import org.hisp.dhis.query.operators.Between; -import org.hisp.dhis.query.operators.Equal; -import org.hisp.dhis.query.operators.GreaterEqual; -import org.hisp.dhis.query.operators.GreaterThan; -import org.hisp.dhis.query.operators.ILike; -import org.hisp.dhis.query.operators.In; -import org.hisp.dhis.query.operators.LessEqual; -import org.hisp.dhis.query.operators.LessThan; -import org.hisp.dhis.query.operators.Like; -import org.hisp.dhis.query.operators.NotEqual; -import org.hisp.dhis.query.operators.NotNull; -import org.hisp.dhis.query.operators.Null; +import org.hisp.dhis.query.operators.BetweenOperator; +import org.hisp.dhis.query.operators.EqualOperator; +import org.hisp.dhis.query.operators.GreaterEqualOperator; +import org.hisp.dhis.query.operators.GreaterThanOperator; +import org.hisp.dhis.query.operators.ILikeOperator; +import org.hisp.dhis.query.operators.InOperator; +import org.hisp.dhis.query.operators.LessEqualOperator; +import org.hisp.dhis.query.operators.LessThanOperator; +import org.hisp.dhis.query.operators.LikeOperator; +import org.hisp.dhis.query.operators.NotEqualOperator; +import org.hisp.dhis.query.operators.NotNullOperator; +import org.hisp.dhis.query.operators.NullOperator; import org.junit.Test; import java.util.Arrays; @@ -58,7 +58,7 @@ @Test public void testBetweenValidTypes() { - Between operator = new Between( "10", "20" ); + BetweenOperator operator = new BetweenOperator( "10", "20" ); assertTrue( operator.isValid( String.class ) ); assertTrue( operator.isValid( Number.class ) ); @@ -69,7 +69,7 @@ @Test public void testBetweenInt() { - Between operator = new Between( "10", "20" ); + BetweenOperator operator = new BetweenOperator( "10", "20" ); assertTrue( operator.test( 10 ) ); assertTrue( operator.test( 15 ) ); @@ -81,7 +81,7 @@ @Test public void testBetweenCollection() { - Between operator = new Between( "2", "4" ); + BetweenOperator operator = new BetweenOperator( "2", "4" ); assertFalse( operator.test( Collections.singletonList( 1 ) ) ); assertTrue( operator.test( Arrays.asList( 1, 2 ) ) ); @@ -93,7 +93,7 @@ @Test public void testEqualValidTypes() { - Equal operator = new Equal( "operator" ); + EqualOperator operator = new EqualOperator( "operator" ); assertTrue( operator.isValid( String.class ) ); assertTrue( operator.isValid( Number.class ) ); @@ -105,7 +105,7 @@ @Test public void testEqual() { - Equal operator = new Equal( "operator" ); + EqualOperator operator = new EqualOperator( "operator" ); assertTrue( operator.test( "operator" ) ); assertFalse( operator.test( Boolean.TRUE ) ); @@ -116,7 +116,7 @@ @Test public void testNotEqualValidTypes() { - NotEqual operator = new NotEqual( "operator" ); + NotEqualOperator operator = new NotEqualOperator( "operator" ); assertTrue( operator.isValid( String.class ) ); assertTrue( operator.isValid( Number.class ) ); @@ -128,7 +128,7 @@ @Test public void testNotEqual() { - NotEqual operator = new NotEqual( "operator" ); + NotEqualOperator operator = new NotEqualOperator( "operator" ); assertFalse( operator.test( "operator" ) ); assertTrue( operator.test( Boolean.TRUE ) ); @@ -139,7 +139,7 @@ @Test public void testGreaterEqualValidTypes() { - GreaterEqual operator = new GreaterEqual( "operator" ); + GreaterEqualOperator operator = new GreaterEqualOperator( "operator" ); assertTrue( operator.isValid( String.class ) ); assertTrue( operator.isValid( Number.class ) ); @@ -151,7 +151,7 @@ @Test public void testGreaterEqual() { - GreaterEqual operator = new GreaterEqual( "10" ); + GreaterEqualOperator operator = new GreaterEqualOperator( "10" ); assertFalse( operator.test( 6 ) ); assertFalse( operator.test( 7 ) ); @@ -166,7 +166,7 @@ @Test public void testGreaterThanValidTypes() { - GreaterThan operator = new GreaterThan( "operator" ); + GreaterThanOperator operator = new GreaterThanOperator( "operator" ); assertTrue( operator.isValid( String.class ) ); assertTrue( operator.isValid( Number.class ) ); @@ -178,7 +178,7 @@ @Test public void testGreaterThan() { - GreaterThan operator = new GreaterThan( "10" ); + GreaterThanOperator operator = new GreaterThanOperator( "10" ); assertFalse( operator.test( 6 ) ); assertFalse( operator.test( 7 ) ); @@ -193,7 +193,7 @@ @Test public void testILikeValidTypes() { - ILike operator = new ILike( "operator" ); + ILikeOperator operator = new ILikeOperator( "operator" ); assertTrue( operator.isValid( String.class ) ); assertFalse( operator.isValid( Number.class ) ); @@ -205,7 +205,7 @@ @Test public void testILike() { - ILike operator = new ILike( "operator" ); + ILikeOperator operator = new ILikeOperator( "operator" ); assertTrue( operator.test( "operator" ) ); assertTrue( operator.test( "OPERATOR" ) ); @@ -215,7 +215,7 @@ @Test public void testLikeValidTypes() { - Like operator = new Like( "operator" ); + LikeOperator operator = new LikeOperator( "operator" ); assertTrue( operator.isValid( String.class ) ); assertFalse( operator.isValid( Number.class ) ); @@ -227,7 +227,7 @@ @Test public void testLike() { - Like operator = new Like( "operator" ); + LikeOperator operator = new LikeOperator( "operator" ); assertTrue( operator.test( "operator" ) ); assertFalse( operator.test( "OPERATOR" ) ); @@ -237,7 +237,7 @@ @Test public void testLessEqualValidTypes() { - LessEqual operator = new LessEqual( "operator" ); + LessEqualOperator operator = new LessEqualOperator( "operator" ); assertTrue( operator.isValid( String.class ) ); assertTrue( operator.isValid( Number.class ) ); @@ -249,7 +249,7 @@ @Test public void testLessEqual() { - LessEqual operator = new LessEqual( "10" ); + LessEqualOperator operator = new LessEqualOperator( "10" ); assertTrue( operator.test( 6 ) ); assertTrue( operator.test( 7 ) ); @@ -264,7 +264,7 @@ @Test public void testLessThanValidTypes() { - LessThan operator = new LessThan( "operator" ); + LessThanOperator operator = new LessThanOperator( "operator" ); assertTrue( operator.isValid( String.class ) ); assertTrue( operator.isValid( Number.class ) ); @@ -276,7 +276,7 @@ @Test public void testLessThan() { - LessThan operator = new LessThan( "10" ); + LessThanOperator operator = new LessThanOperator( "10" ); assertTrue( operator.test( 6 ) ); assertTrue( operator.test( 7 ) ); @@ -291,7 +291,7 @@ @Test public void testNullValidTypes() { - Null operator = new Null(); + NullOperator operator = new NullOperator(); assertTrue( operator.isValid( String.class ) ); assertTrue( operator.isValid( Number.class ) ); @@ -303,7 +303,7 @@ @Test public void testNull() { - Null operator = new Null(); + NullOperator operator = new NullOperator(); assertTrue( operator.test( null ) ); assertFalse( operator.test( "test" ) ); @@ -312,7 +312,7 @@ @Test public void testNotNullValidTypes() { - NotNull operator = new NotNull(); + NotNullOperator operator = new NotNullOperator(); assertTrue( operator.isValid( String.class ) ); assertTrue( operator.isValid( Number.class ) ); @@ -324,7 +324,7 @@ @Test public void testNotNull() { - NotNull operator = new NotNull(); + NotNullOperator operator = new NotNullOperator(); assertFalse( operator.test( null ) ); assertTrue( operator.test( "test" ) ); @@ -333,7 +333,7 @@ @Test public void testInValidTypes() { - In operator = new In( "[1,2,3]" ); + InOperator operator = new InOperator( "[1,2,3]" ); assertTrue( operator.isValid( String.class ) ); assertTrue( operator.isValid( Number.class ) ); @@ -345,7 +345,7 @@ @Test public void testInInt() { - In operator = new In( "[1,2,3]" ); + InOperator operator = new InOperator( "[1,2,3]" ); assertFalse( operator.test( 0 ) ); assertTrue( operator.test( 1 ) ); @@ -357,7 +357,7 @@ @Test public void testInString() { - In operator = new In( "[b,c,d]" ); + InOperator operator = new InOperator( "[b,c,d]" ); assertFalse( operator.test( "a" ) ); assertTrue( operator.test( "b" ) ); @@ -374,7 +374,7 @@ @Test public void testInEnum() { - In operator = new In( "[A,B]" ); + InOperator operator = new InOperator( "[A,B]" ); assertTrue( operator.test( TestEnum.A ) ); assertTrue( operator.test( TestEnum.B ) );
_______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp