Ejemplo n.º 1
0
	@Override
	public List<Club> findAllClubs(int communityNo) {

		List<Club> clubList = clubDao.readAllClubByCommunityId(communityNo);


		for (Club club : clubList){
			List<Member> members = memberDao.readMemberByGroup(club.getId(), 2);

			for (Member member : members){
				//System.out.println(club.getName() + " / "+member.getEmail());
				if(member.getLevel()==1){
					//System.out.println("멤버 : "+club.getName() + " / "+member.getEmail());
					club.addMember(userDao.readUser(member.getEmail()));
				}
				else {
					//System.out.println("매니저 : "+club.getName() + " / "+member.getEmail());
					club.addManager(userDao.readUser(member.getEmail()), member.getLevel());
					club.addMember(userDao.readUser(member.getEmail()));
				}
			}
		}

		/*for (Club club : clubList){
			System.out.println("----------------------------------------");
			System.out.println("클럽이름 : "+club.getName());
			System.out.println("매니저 : "+club.getManager().getEmail());
			System.out.println("멤버 : "+club.getMembers().size());
		}*/

		return clubList;
	}
Ejemplo n.º 2
0
	@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;
	}
Ejemplo n.º 3
0
	@Override
	public void removeClub(int clubNo) {
		//
		List<Member> memberList = memberDao.readMemberByGroup(clubNo, 2);
    	for (Member member : memberList) {
    		memberDao.deleteMember(member);
		}
		clubDao.deleteClub(clubNo);
	}
Ejemplo n.º 4
0
	@Override
	public Club findAllClubMember(int clubNo) {
		
		Club club = clubDao.readClub(clubNo);
		
		List<Member> allMembers = memberDao.readMemberByGroup(clubNo, 2);

		for(Member member : allMembers){
			if(member.getLevel()==1){
				club.addMember(userDao.readUser(member.getEmail()));
			}
			else if(member.getLevel()==2){
				club.addManager(userDao.readUser(member.getEmail()), 2);
			} else {
				club.addManager(userDao.readUser(member.getEmail()), 3);
			}
		}
		
		return club;
	}
Ejemplo n.º 5
0
	@Override
	public Club findClub(int clubNo) {
		//
		Club club = clubDao.readClub(clubNo);
		if (club == null) {
			throw NamooExceptionFactory.createRuntime("클럽이 존재하지 않습니다.");
		}
		List<Member> members = memberDao.readMemberByGroup(clubNo, 2);
		for (Member member : members){
			//System.out.println(club.getName() + " / "+member.getEmail());
			if(member.getLevel()==1){
				//System.out.println("멤버 : "+club.getName() + " / "+member.getEmail());
				club.addMember(userDao.readUser(member.getEmail()));
			}
			else {
				//System.out.println("매니저 : "+club.getName() + " / "+member.getEmail());
				club.addManager(userDao.readUser(member.getEmail()), member.getLevel());
				club.addMember(userDao.readUser(member.getEmail()));
			}
		}
		return club;
	}
Ejemplo n.º 6
0
	@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;
	}