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; }
public MemberDTO getMember(String Id) { Member m = new Member(); DBFacadeInterface db = DBFacade.getInstance(); db.beginTransaction(); m = db.get(Member.class, Id); db.commitTransaction(); return DTOMapper.getMapper().map(m, MemberDTO.class); }