public boolean checkForExistingMember(String fname, String lname, String birthday) { DBFacadeInterface db = DBFacade.getInstance(); List<Member> allMembers = db.getAll(Member.class); for (Member checkMember : allMembers) { if (fname.equals(checkMember.getFirstName()) && lname.equals(checkMember.getLastName()) && birthday.equals(checkMember.getBirthday())) { return true; } } return false; }
public Member fillMember( Member member, String gender, String country, String fname, String lname, String street, String streetnumber, String postalCode, String city, String telephone, String mail, String birthday, Collection<String> roles, Collection<String> departments, String status) throws CouldNotSaveObjectException, MemberAlreadyExistsException, SomeFieldsNotSetException { DBFacadeInterface db = DBFacade.getInstance(); Set<Role> rolesSet = new HashSet<>(); Set<Department> departmentSet = new HashSet<>(); // checks if all fields are set areAllFieldsSet( gender, country, fname, lname, street, streetnumber, postalCode, city, birthday); for (String roleID : roles) { Role role = db.get(Role.class, roleID); if (role != null) { rolesSet.add(role); } } for (String departmentID : departments) { Department department = db.get(Department.class, departmentID); if (department != null) { departmentSet.add(department); department.getMembers().add(member); } } member.setDepartments(departmentSet); member.setRoles(rolesSet); member.setGender(gender); member.setCountry(country); member.setFirstName(fname); member.setLastName(lname); member.setStreet(street); member.setStreetNumber(streetnumber); member.setZIP(postalCode); member.setCity(city); member.setPhone(telephone); member.setMail(mail); member.setBirthday(birthday); member.setStatus(status); return member; }