/** * If this field is used with <code>resultMode == RESULT_MAP</code>, the * <code>property</code> will also be used as the key for this value in the * map. */ public static void addField(IMutableSearch search, String property) { if (property == null) return; // null properties do nothing, don't bother to add them. addField(search, new Field(property)); }
public void setFields(Field[] fields) { this.fields.clear(); if (fields != null) { for (int i = 0; i < fields.length; i++) { Field f = fields[i]; if (f != null && f.getProperty() != null && f.getProperty().length() > 0) { if (f.getKey() == null) f.setKey(f.getProperty()); this.fields.add(f); } } } }
/** * <ol> * <li>Check for injection attack in property strings. <li>The field list * may not contain nulls. * </ol> */ protected List<Field> checkAndCleanFields(List<Field> fields) { if (fields == null) return null; for (Field field : fields) { if (field == null) { throw new IllegalArgumentException("The search contains a null field."); } if (field.getProperty() != null && field.getOperator() != Field.OP_CUSTOM) securityCheckProperty(field.getProperty()); } return fields; }
public static void removeField(IMutableSearch search, String property, String key) { if (search.getFields() == null) return; Iterator<Field> itr = search.getFields().iterator(); while (itr.hasNext()) { Field field = itr.next(); if (field.getProperty().equals(property) && field.getKey().equals(key)) itr.remove(); } }
public static void removeField(IMutableSearch search, String property) { if (search.getFields() == null) return; Iterator<Field> itr = search.getFields().iterator(); while (itr.hasNext()) { if (itr.next().getProperty().equals(property)) itr.remove(); } }
while (fieldItr.hasNext()) { Field field = fieldItr.next(); if (field.getKey() != null && !field.getKey().equals("")) { resultMode = ISearch.RESULT_MAP; break; while (fieldItr.hasNext()) { Field field = fieldItr.next(); if (field.getKey() != null && !field.getKey().equals("")) { keyList.add(field.getKey()); } else { keyList.add(field.getProperty());
if (field.getOperator() == Field.OP_PROPERTY) { fieldProps.add(field.getProperty() + ".");
while (fieldItr.hasNext()) { Field field = fieldItr.next(); if (field.getKey() != null && !field.getKey().equals("")) { resultMode = ISearch.RESULT_MAP; break; while (fieldItr.hasNext()) { Field field = fieldItr.next(); if (field.getKey() != null && !field.getKey().equals("")) { keyList.add(field.getKey()); } else { keyList.add(field.getProperty());
/** * If this field is used with <code>resultMode == RESULT_MAP</code>, the * <code>key</code> will be used as the key for this value in the map. */ public static void addField(IMutableSearch search, String property, int operator, String key) { if (property == null || key == null) return; // null properties do nothing, don't bother to add them. addField(search, new Field(property, operator, key)); }
if (field.getOperator() == Field.OP_CUSTOM) { if (field.getProperty() == null) { sb.append("null"); } else { appendCustomExpression(sb, ctx, field.getProperty()); if (field.getProperty() == null || "".equals(field.getProperty())) { prop = ctx.getRootAlias(); } else { AliasNode aliasNodeForProperty = getAliasForPathIfItExists(ctx, field.getProperty()); if (aliasNodeForProperty != null) { prop = aliasNodeForProperty.alias; } else { prop = getPathRef(ctx, field.getProperty()); switch (field.getOperator()) { case Field.OP_AVG: sb.append("avg(");
/** * If this field is used with <code>resultMode == RESULT_MAP</code>, the * <code>key</code> will be used as the key for this value in the map. */ public static void addField(IMutableSearch search, String property, String key) { if (property == null || key == null) return; // null properties do nothing, don't bother to add them. addField(search, new Field(property, key)); }
if (fields != null) { for (Field field : fields) { switch (field.getOperator()) { case Field.OP_AVG: case Field.OP_COUNT: } else if (fields.size() == 1) { sb.append("select count(distinct "); String prop = fields.get(0).getProperty(); if (prop == null || "".equals(prop)) { sb.append(ctx.getRootAlias());
/** * If this field is used with <code>resultMode == RESULT_MAP</code>, the * <code>property</code> will also be used as the key for this value in the * map. */ public static void addField(IMutableSearch search, String property, int operator) { if (property == null) return; // null properties do nothing, don't bother to add them. addField(search, new Field(property, operator)); }