@Override public List<Club> findBelongClubs(int communityNo, String email) { // List<Member> memberList = memberDao.readMembersByPerson(email); List<Club> BelongClubs = new ArrayList<Club>(); System.out.println("member : "+memberList.size()); for (Member member : memberList) { if(member.getGroupType() == 2){ Club club = clubDao.readClub(member.getGroupNo()); if(club.getCommunityId() == communityNo){ List<Member> members = memberDao.readMemberByGroup(club.getId(), 2); for (Member member2 : members){ if(member2.getLevel()==1){ club.addMember(userDao.readUser(member2.getEmail())); } else{ club.addManager(userDao.readUser(member2.getEmail()), member2.getLevel()); club.addMember(userDao.readUser(member2.getEmail())); } } System.out.println(club.getManager().get(0).getManager().getEmail()); BelongClubs.add(club);/////여기에서 에러가 나던지 아니면 BelongclUBS를 사용하는 과정에서 에러가 나던지 둘 중 하나 } } } return BelongClubs; }
@Override public void joinAsMember(int clubNo, String email) { // int communityId = clubDao.readClub(clubNo).getCommunityId(); List<Member> mem = memberDao.readMembersByPerson(email); for (Member member : mem){ if(member.getGroupType()==1 && member.getGroupNo()==communityId){ member = new Member(email, clubNo, 2, 1); memberDao.createMember(member); return; } } throw NamooExceptionFactory.createRuntime("커뮤니티에 가입 후 소속 클럽에 가입하실 수 있습니다."); }
@Override public List<Club> findManagedClubs(String email) { // List<Member> memberList = memberDao.readMembersByPerson(email); List<Club> ManagedClubs = new ArrayList<Club>(); for (Member member : memberList) { if(member.getGroupType() == 2 && member.getLevel() == 3){ Club club = clubDao.readClub(member.getGroupNo()); List<Member> members = memberDao.readMemberByGroup(club.getId(), 2); for (Member member2 : members){ if(member2.getLevel()==1){ club.addMember(userDao.readUser(member2.getEmail())); } else{ club.addManager(userDao.readUser(member.getEmail()), member.getLevel()); club.addMember(userDao.readUser(member2.getEmail())); } } ManagedClubs.add(club); } } return ManagedClubs; }