@Override @DELETE @Path("/workitem/{workItemName}") // fix problem with equals in user class // can't remove from user.workItem map public Response removeWorkItem(@PathParam("workItemName") final String workItemName) { WorkItem workItem = ticketSystemService.getWorkItem(workItemName); ticketSystemService.removeWorkItem(workItem); return Response.status(200).build(); }
@Override @GET @Path("/workitem/{workItemName}") public Response getWorkItem(@PathParam("workItemName") final String workItemName) { try { WorkItem workItem = ticketSystemService.getWorkItem(workItemName); return Response.status(200).entity(gson.toJson(workItem)).build(); } catch (final TicketSystemServiceException exception) { return Response.status(400).entity(exception).build(); } }
@Override @PUT @Path("/workitem/changestatus/{workItemName}/{status}") public Response changeWorkItemStatus( @PathParam("workItemName") final String workItemName, @PathParam("status") final String status) { try { WorkItem updateWorkItem = ticketSystemService.getWorkItem(workItemName); updateWorkItem = ticketSystemService.changeWorkItemStatus(updateWorkItem, status); return Response.status(200).entity(gson.toJson(updateWorkItem)).build(); } catch (final TicketSystemServiceException exception) { return Response.status(400).entity(exception).build(); } }