@PUT public WorkStation updateLaptop(WorkStation customer) { System.out.println( "----invoking updateCustomer, " + customer.getId() + "Customer name is: " + customer.getName()); for (WorkStation c : cc.getUsers()) { if (c.getId() == customer.getId()) { c.setName(customer.getName()); return c; } } return customer; }
@GET @Path("/{id}/") public WorkStation getLaptop(@PathParam("id") String id) { System.out.println("----invoking getCustomer, Customer id is: " + id); long idNumber = Long.parseLong(id); for (WorkStation c : cc.getUsers()) { if (c.getId() == idNumber) { return c; } } return null; }
@DELETE @Path("/{id}/") public WorkStation deleteLaptop(@PathParam("id") String id) { System.out.println("----invoking deleteCustomer, Customer id is: " + id); long idNumber = Long.parseLong(id); for (WorkStation c : cc.getUsers()) { if (c.getId() == idNumber) { cc.getUsers().remove(c); return c; } } return null; }