I’m trying to append two BooleanExpression.
One is a regulate BooleanExpression, the other is created out of a Path.
I think my usage of the Path is wrong. My code:
public static Path<?> getPathByColumnName(String columnName) {
Path<?> retval = null;
QProfile p = QProfile.profile;
if (columnName.equals("name")) {
retval = p.name;
} else if (columnName.equals("account")) {
retval = p.account.name;
} else if (columnName.equals("isPublic")) {
retval = p.isPublic;
} else if (columnName.equals("datavendors")) {
retval = p.dataVendors.any().name;
}
return retval;
}
The Path is then sent to the following method
public static BooleanExpression getFilterPredicateByFilterAndPath(Path path, FilerType type, String filter) {
BooleanExpression retval = null;
if (path instanceof StringPath) {
if (FilerType.CONTAIN.equals(type)) {
retval = ((StringPath)path).like(filter);
}
} else if (path instanceof BooleanPath) {
if (FilerType.EQUAL.equals(type)) {
retval = ((BooleanPath)path).eq(Boolean.valueOf(filter));
}
}
return retval;
}
Then I’m trying to abbend the recived BooleanExpression to the regulare one. This does not work. Any Ideas will be welcomed.
My bad. The usage of Path was correct the error was in a different part of the code.