if (filtName.equals(Entity.KEY_RESERVED_PROPERTY)) {
filtName = "ONPOSITIVE_FILTER_FOR_PRIMARY_KEY";
}
if (cText != null && cText.trim().equals("<null>")) {
filters.add(new Filter(filtName, operator, null));
continue l2;
}
if (cText != null && cText.trim().length() != 0) {
HashSet<Object> hashSet = values.get(f.name);
if (hashSet != null) {
for (Object o : hashSet) {
if (c.getObjectText(o).equals(cText)) {
filters.add(new Filter(filtName, operator, o));
continue l2;
}
}
}
if (f.getType() == String.class) {
filters.add(new Filter(filtName, operator, cText.trim()));
} else if (Number.class.isAssignableFrom(f.getType())) {
if (f.getType() == Long.class) {
try {
filters.add(new Filter(filtName, operator, Long
.parseLong(cText.trim())));
} catch (NumberFormatException e) {
try {
filters.add(new Filter(filtName, operator,
Double.parseDouble(cText.trim())));
} catch (NumberFormatException e1) {
// just ignoring such filter
}
}
} else if (f.getType() == Double.class) {
try {
filters.add(new Filter(filtName, operator,
Double.parseDouble(cText.trim())));
} catch (NumberFormatException e) {
// just ignoring such filter
}
}
} else if (f.getType() == Key.class) {
try {
Key parseKey = new KeyParser().parseKey(cText
.trim());
filters.add(new Filter(filtName, operator, parseKey));
} catch (Exception e) {
String s = cText.trim();
if (c.name.equals(Entity.KEY_RESERVED_PROPERTY)) {
String[] details = c.getKeyKindDetails();
if (details != null && details.length != 0) {
String[] splitted = s.split(",");
for (int i = 0; i < details.length; i++) {
String ff = details[i];
String fv = "";
if (i < splitted.length) {
fv = splitted[i];
filters.add(new Filter(ff,
Filter.EQUAL, fv));
}
}
}
} else {
filters.add(new Filter(filtName,
Filter.COMPLEX_FILTER,
new Request.ComplexFilter(s, c)));
}
}
} else if (f.getType() == Date.class) {
try {
Date parse = dt.parse(cText);
filters.add(new Filter(filtName, operator, parse));
} catch (Exception e) {
Display.getDefault().syncExec(new Runnable() {
public void run() {