}
};
add(sortMenu);
// Build Query here
QueryBuilder qb = new QueryBuilder(queryParam);
if (!qb.containsField(Lucene.status.name()) && !ArrayUtils.isEmpty(statiiParam)) {
// specify the states
boolean not = false;
QueryBuilder q = new QueryBuilder();
for (String state : statiiParam) {
if (state.charAt(0) == '!') {
not = true;
q.and(Lucene.status.doesNotMatch(state.substring(1)));
} else {
q.or(Lucene.status.matches(state));
}
}
if (not) {
qb.and(q.toString());
} else {
qb.and(q.toSubquery().toString());
}
}
final String luceneQuery;
if (qb.containsField(Lucene.createdby.name())
|| qb.containsField(Lucene.responsible.name())
|| qb.containsField(Lucene.watchedby.name())) {
// focused "my tickets" query
luceneQuery = qb.build();
} else {
// general "my tickets" query
QueryBuilder myQuery = new QueryBuilder();
myQuery.or(Lucene.createdby.matches(username));
myQuery.or(Lucene.responsible.matches(username));
myQuery.or(Lucene.watchedby.matches(username));
myQuery.and(qb.toSubquery().toString());
luceneQuery = myQuery.build();
}
// paging links
int page = (params != null) ? Math.max(1, WicketUtils.getPage(params)) : 1;
int pageSize = app().settings().getInteger(Keys.tickets.perPage, 25);