public Response addCustomer(Customer customer) { System.out.println("----invoking addCustomer, Customer name is: " + customer.getName()); customer.setId(++currentId); customers.put(customer.getId(), customer); return Response.ok(customer).build(); }
public Response updateCustomer(Customer customer) { System.out.println("----invoking updateCustomer, Customer name is: " + customer.getName()); Customer c = customers.get(customer.getId()); Response r; if (c != null) { customers.put(customer.getId(), customer); r = Response.ok().build(); } else { r = Response.notModified().build(); } return r; }
final void init() { Customer c = new Customer(); c.setName("John"); c.setId(123); customers.put(c.getId(), c); }