示例#1
0
  @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;
  }
示例#2
0
 @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;
 }
示例#3
0
 @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;
 }