public CustomerRepresentation login(String customerName, String customerPassword) { Set<Customer> customers = new HashSet<Customer>(); customers = CustomerDAO.getAllCustomers(); for (Customer c : customers) { if (c.getName().equals(customerName) && c.getPassword().equals(customerPassword)) { return getCustomer(String.valueOf(c.getID())); } } return null; }
public Set<CustomerRepresentation> getCustomers() { Set<Customer> customers = new HashSet<Customer>(); Set<CustomerRepresentation> customerReps = new HashSet<CustomerRepresentation>(); customers = CustomerDAO.getAllCustomers(); for (Customer c : customers) { CustomerRepresentation customerRep = new CustomerRepresentation(); customerRep.setID(c.getID()); customerRep.setCustomerName(c.getName()); customerRep.setCustomerAddress(c.getAddress()); customerRep.setCustomerBillingInfoID(c.getBillingInfo().getID()); customerReps.add(customerRep); setLinks(customerRep); } return customerReps; }