.setDescription("Optionally, the ID of the current filter");
}
@Override
public void handle(Request request, Response response) throws Exception {
UserSession session = UserSession.get();
JsonWriter json = response.newJsonWriter();
json.beginObject();
// Current filter (optional)
Integer filterId = request.paramAsInt("id");
DefaultIssueFilter filter = null;
if (filterId != null && filterId >= 0) {
filter = service.find((long) filterId, session);
}
// Permissions
json.prop("canManageFilters", session.isLoggedIn());
json.prop("canBulkChange", session.isLoggedIn());
// Selected filter
if (filter != null) {
issueFilterWriter.write(session, filter, json);
}
// Favorite filters, if logged in
if (session.isLoggedIn()) {
List<DefaultIssueFilter> favorites = service.findFavoriteFilters(session);
json.name("favorites").beginArray();
for (DefaultIssueFilter favorite : favorites) {
json
.beginObject()