I want to query my identities and show it in a table with sorting, pagination and filtering options. It's all ok but i haven't found a way to introduce NOT conditions.
In the code, the T variable is an org.picketlink.idm.model.IdentityType and identityClass is the real class.
IdentityQueryBuilder queryBuilder = getIdentityManager().getQueryBuilder();
IdentityQuery<T> query = queryBuilder.createIdentityQuery(identityClass);
List<Condition> condizioni = new ArrayList<>();
conditions.addAll(conditionFromFilterClausole(queryBuilder, ffc));
Condition c[] = condizioni.toArray(new Condition[condizioni.size()]);
query.where( c);
...
in the method conditionFromFilterClausole i translate some object (FilterClause) in where conditions for identity query. FilterClause.field is the column name, FilterClause.operator is the type of condition and FilterClause.value is the value to use
for(FilterClause f : lf){
QueryParameter qp = new org.picketlink.idm.query.AttributeParameter(f.getField());
switch(f.operator){
case EQUAL:
conditions.add(qb.equal(qp, f.value));
break;
case CONTAINS :
conditions.add(qb.like(qp, (String) f.value));
break;
case ENDSWITH :
???
case STARTSWITH :
???
break;
case GREATEREQUAL :
conditions.add( qb.greaterThanOrEqualTo(qp, (String) f.value));
break;
case GREATERTHEN :
conditions.add(qb.greaterThan(qp, (String) f.value));
break;
case LESSEQUAL:
conditions.add( qb.lessThanOrEqualTo(qp, (String) f.value));
break;
case LESSTHEN:
conditions.add(qb.lessThan(qp, (String) f.value));
break;
case IN:
conditions.add(qb.in(qp, f.value));
break;
case NOTIN:
case NOTCONTAINS:
case NOTEQUAL:
???
break;
}
I miss the way to create conditions for "STARTSWITH/ENDSWITH" and all the other conditions with a NOT, for example the classic not equal (all the case with ???). QueryBuilder hasn't those methods.