@GET @Path("/package/{pkgName}") public Response getIoAssociations( @QueryParam("q") String filter, @PathParam("pkgName") String pkgName, @Context ServletContext context) { setContext(context); String[] filters = filter == null ? new String[0] : filter.split(" "); String newFilter = filters.length == 0 ? (filter == null ? "" : filter) : ""; for (String subFilter : filters) { if (subFilter.startsWith("iotype:")) { // TODO String type = subFilter.replace("iotype:", ""); decide what to do with this filter } else { newFilter += subFilter + " "; } } if (newFilter.endsWith(" ")) { newFilter = newFilter.substring(0, newFilter.length() - 1); // remove last space } try { List<TaskRef> tasks = taskService.query(pkgName, newFilter); ListTasksDTO dto = new ListTasksDTO(tasks); return Response.ok(dto, MediaType.APPLICATION_XML).build(); } catch (TaskServiceException e) { return error( "Problem getting io associations for package " + pkgName + " with filter " + filter, e); } }
@GET @Path("/package/{pkgName}/process/{procName}/task/{taskName}") public Response getIoAssociation( @PathParam("pkgName") String pkgName, @PathParam("procName") String procName, @PathParam("taskName") String taskName, @Context ServletContext context) { setContext(context); try { List<TaskRef> tasks = taskService.getTasksByName(pkgName, procName, taskName); ListTasksDTO dto = new ListTasksDTO(tasks); return Response.ok(dto, MediaType.APPLICATION_XML).build(); } catch (TaskServiceException e) { return error( "Problem getting io association for package " + pkgName + ", process " + procName + ", task " + taskName, e); } }