* the value will have the given prefix appended to it's string value if it does not have it,
* the returned restriction will have the key set to the input key,
* otherwise returns null
*/
public static Restriction findSearchRestriction(Search search, String key, String[] keys, String valuePrefix) {
Restriction r = search.getRestrictionByProperties(keys);
if (r != null) {
Object value = r.getValue();
if (valuePrefix != null) {
String sval = r.getStringValue();
if (!sval.startsWith(valuePrefix)) {
value = valuePrefix + sval;
}
}
r = new Restriction(key, value);
}
return r;
}