RestConstants.JOBS_FILTER_PARAM);
}
try {
Map<String, List<String>> filterList = parseFilter(URLDecoder.decode(filterString, "UTF-8"), SLA_FILTER_NAMES);
SLASummaryFilter filter = new SLASummaryFilter();
if (filterList.containsKey(OozieClient.FILTER_SLA_ID)) {
filter.setJobId(filterList.get(OozieClient.FILTER_SLA_ID).get(0));
}
if (filterList.containsKey(OozieClient.FILTER_SLA_PARENT_ID)) {
filter.setParentId(filterList.get(OozieClient.FILTER_SLA_PARENT_ID).get(0));
}
if (filterList.containsKey(OozieClient.FILTER_SLA_APPNAME)) {
filter.setAppName(filterList.get(OozieClient.FILTER_SLA_APPNAME).get(0));
}
if (filterList.containsKey(OozieClient.FILTER_SLA_NOMINAL_START)) {
filter.setNominalStart(DateUtils.parseDateUTC(filterList.get(OozieClient.FILTER_SLA_NOMINAL_START).get(0)));
}
if (filterList.containsKey(OozieClient.FILTER_SLA_NOMINAL_END)) {
filter.setNominalEnd(DateUtils.parseDateUTC(filterList.get(OozieClient.FILTER_SLA_NOMINAL_END).get(0)));
}
if (filter.getAppName() == null && filter.getJobId() == null && filter.getParentId() == null) {
throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.E0305,
"At least one of the filter parameters - " + OozieClient.FILTER_SLA_ID + ","
+ OozieClient.FILTER_SLA_PARENT_ID + " or " + OozieClient.FILTER_SLA_APPNAME
+ " should be specified in the filter query parameter");
}