//このクラスは仮です package hibernateTest.entities; import hibernateTest.models.Groups; import hibernateTest.models.Users; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; public class Group { private String gId; private String uri, name; private Set<User> members = new HashSet<>();//HashSetでいいのかな? //private ArrayList<Request> requests; private Set<Request> requests; public Group(){ } public Group(String gId, String uri, String name, String uId){ setgId(gId); setUri(uri); setName(name); addMember(uId); } public String getgId(){ return gId; } private void setgId(String gId){ this.gId = gId; } public String getUri() { return uri; } private void setUri(String uri){ this.uri = uri; } public String getUriByGid(String gId){ return uri; } private void setName(String name){ this.name = name; } public String getName(){ return name; } public String getNameByGid(String gId){ return name; } public Set<Request> getRequests(){ return requests; } public void setRequests(Set<Request> requests){ this.requests = requests; } public void addRequests(Request request){ requests.add(request); } // public ArrayList<Request> getRequestsList(){ // ArrayList<Request> list = new ArrayList<Request>(getRequests()); // return list; // } public void setMembers(Set<User> members) { this.members = members; } public Set<User> getMembers() { return members; } public void addMember(String uId){ //test用 User user = new User(uId, uId, "http:test", "sa", "hogehoge"); // User user = Users.getInstance().getUserById(uId); members.add(user); user.addGroups(this); } // public List<Request> getRequests(){ // return requests; // } // // public void setRequests(List<Request> requests){ // this.requests = requests; // } // // public void addRequests(Request request){ // requests.add(request); // } // // public ArrayList<Request> getRequestsList(){ // ArrayList<Request> list = new ArrayList<Request>(getRequests()); // return list; // } }