@ModelAttribute("filters") public static List<TrackerFilterEnum> getFilter(HttpServletRequest request) { Template tmpl = Template.getTemplate(request); if (tmpl.isSessionAuthorized()) { return Arrays.asList(TrackerFilterEnum.values()); } else { List<TrackerFilterEnum> trackerFilters = new ArrayList<>(); for (TrackerFilterEnum trackerFilter : TrackerFilterEnum.values()) { if ("mine".equals(trackerFilter.getValue())) { continue; } trackerFilters.add(trackerFilter); } return trackerFilters; } }
static { filterValues = new HashSet<>(); for (TrackerFilterEnum eventFilter : TrackerFilterEnum.values()) { filterValues.add(eventFilter.getValue()); } }