Changeset 2439
- Timestamp:
- 11/30/09 22:48:35 (2 years ago)
- Location:
- molgenis/3.3/src/org/molgenis/framework/db
- Files:
-
- 2 edited
-
Query.java (modified) (9 diffs)
-
QueryImp.java (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
molgenis/3.3/src/org/molgenis/framework/db/Query.java
r2382 r2439 43 43 44 44 /** 45 * Shorthand for equals 46 * @param field 47 * @param value 48 * @return 49 */ 50 public abstract Query<E> eq( String field, Object value ); 51 52 53 /** 45 54 * Shorthand for 46 55 * … … 59 68 */ 60 69 public abstract Query<E> greater( String field, Object value ); 70 71 /** 72 * Shorthand for greater 73 * @param field 74 * @param value 75 * @return 76 */ 77 public abstract Query<E> gt(String field, Object value); 61 78 62 79 /** … … 67 84 * </pre> 68 85 */ 69 public abstract Query greaterOrEqual( String field, Object value );86 public abstract Query<E> greaterOrEqual( String field, Object value ); 70 87 71 88 /** … … 77 94 */ 78 95 public abstract Query<E> less( String field, Object value ); 96 97 /** 98 * Shorthand for lessThan 99 */ 100 public abstract Query<E> lt( String field, Object value ); 79 101 80 102 /** … … 85 107 * </pre> 86 108 */ 87 public abstract Query lessOrEqual( String field, Object value );109 public abstract Query<E> lessOrEqual( String field, Object value ); 88 110 89 111 … … 95 117 * </pre> 96 118 */ 97 public abstract Query like(String field, Object value); 119 public abstract Query<E> like(String field, Object value); 120 121 /** 122 * Between, inclusive 123 * @param field 124 * @param min minimum valid value 125 * @param max maximum valid value 126 * @return Query 127 */ 128 public abstract Query<E> between(String field, Object min, Object max); 129 130 /** Add the 'or' option on last queryrule */ 131 public abstract Query<E> or(); 132 133 /** 134 * Add the 'and' option on last query rule (default) 135 */ 136 public abstract Query<E> and(); 98 137 99 138 /** … … 131 170 * </pre> 132 171 */ 133 public abstract Query<E> orderASC( String orderByField );172 public abstract Query<E> sortASC( String orderByField ); 134 173 135 174 /** … … 140 179 * </pre> 141 180 */ 142 public abstract Query<E> orderDESC( String orderByField );181 public abstract Query<E> sortDESC( String orderByField ); 143 182 144 183 /** … … 205 244 /** Add rules to the query */ 206 245 public abstract void addRules( QueryRule... addRules ); 207 208 /** Add the 'or' option on last queryrule */209 public abstract void or();210 211 246 } -
molgenis/3.3/src/org/molgenis/framework/db/QueryImp.java
r2382 r2439 90 90 return this; 91 91 } 92 92 93 @Override 94 public Query<E> between(String field, Object min, Object max) 95 { 96 return this.lessOrEqual(field, max).greaterOrEqual(field, min); 97 } 98 93 99 public Query<E> like(String field, Object value) 94 100 { … … 115 121 } 116 122 117 public Query<E> orderASC(String orderByField)123 public Query<E> sortASC(String orderByField) 118 124 { 119 125 rules.add(new QueryRule(Operator.SORTASC, orderByField)); … … 121 127 } 122 128 123 public Query<E> orderDESC(String orderByField)129 public Query<E> sortDESC(String orderByField) 124 130 { 125 131 rules.add(new QueryRule(Operator.SORTDESC, orderByField)); … … 207 213 208 214 @Override 209 public voidor()215 public Query<E> or() 210 216 { 211 217 if (this.rules.size() > 0) … … 213 219 this.rules.lastElement().setOr(true); 214 220 } 215 221 return this; 222 } 223 224 @Override 225 public Query<E> and() 226 { 227 if (this.rules.size() > 0) 228 { 229 this.rules.lastElement().setOr(false); 230 } 231 return this; 232 } 233 234 @Override 235 public Query<E> eq(String field, Object value) 236 { 237 return this.equals(field, value); 238 } 239 240 @Override 241 public Query<E> gt(String field, Object value) 242 { 243 return this.greater(field, value); 244 } 245 246 @Override 247 public Query<E> lt(String field, Object value) 248 { 249 return this.less(field, value); 216 250 } 217 251 }
Note: See TracChangeset
for help on using the changeset viewer.