public String getGroupDetails() { GroupDAO grp = new GroupDAOImpl(); System.out.println("group_id " + group_id); setGroupDetail(null); HttpSession session = ServletActionContext.getRequest().getSession(false); User u = (User) session.getAttribute("user"); if (!(group_id == null)) { setGroupDetail(grp.getGroupDetails(group_id, Integer.parseInt(u.getUserId()))); System.out.println("group id" + groupDetail.getGroup_id()); System.out.println("group name" + groupDetail.getGroup_name()); } NewsFeedAction n = new NewsFeedAction(); setGrpList(grp.getAllGroups(Integer.parseInt(u.getUserId()))); setFeedList(n.getGroupNewsFeed(group_id)); int i = 0; while (i < grpList.size()) { System.out.println(grpList.get(i).getGroup_id()); i++; } i = 0; System.out.println("post.................."); while (i < feedList.size()) { System.out.println(feedList.get(i).getPostId()); i++; } HttpServletRequest request = ServletActionContext.getRequest(); request.setAttribute("groupDetail", groupDetail); request.setAttribute("grpList", grpList); request.setAttribute("groupDetail", groupDetail); return "success"; }
public String joinGroupAgain() { HttpSession session = ServletActionContext.getRequest().getSession(false); User u = (User) session.getAttribute("user"); GroupDAO grp = new GroupDAOImpl(); int grp_id = Integer.parseInt(group_id); grp.joinGroupAgain(Integer.parseInt(u.getUserId()), grp_id); return "success"; }
public String addMemberToGroup() { System.out.println("add member to group..............................."); System.out.println("add member to group .......group_id::::::::::::::::" + group_id); GroupDAO grp = new GroupDAOImpl(); setAlbum_id(grp.addMemberToGroup(group_id, grpMembers)); getGroupDetail(); return "success"; }
public String leaveGroup() throws Exception { HttpSession session = ServletActionContext.getRequest().getSession(false); User u = (User) session.getAttribute("user"); GroupDAO grp = new GroupDAOImpl(); int grp_id = Integer.parseInt(group_id); grp.leaveGroup(Integer.parseInt(u.getUserId()), grp_id); System.out.println("coming back" + grp_id); return "success"; }
public String getFriends() { HttpSession session = ServletActionContext.getRequest().getSession(false); User u = (User) session.getAttribute("user"); GroupDAO grp = new GroupDAOImpl(); setGrpUserList(grp.getUserForGroup(Integer.parseInt(u.getUserId()))); /*for(int i=0;i<grpUserList.size();i++) { System.out.println(grpUserList.get(i).getFirst_name()); }*/ return "success"; }
public String searchToAddMember() { System.out.println("search to add member group_id" + group_id); HttpSession session = ServletActionContext.getRequest().getSession(false); User u = (User) session.getAttribute("user"); GroupDAO grp = new GroupDAOImpl(); setGrpAddUserList(grp.getUserToAddForGroup(Integer.parseInt(u.getUserId()), group_id)); System.out.println("friends"); for (int i = 0; i < grpAddUserList.size(); i++) { System.out.println(grpAddUserList.get(i).getFirstName()); } return "success"; }
public String execute() throws NamingException, SQLException { HttpSession session = ServletActionContext.getRequest().getSession(false); User u = (User) session.getAttribute("user"); GroupDAO grp = new GroupDAOImpl(); System.out.println("icon " + icon); setGroup_id( String.valueOf( grp.insertGroupDetails(Integer.parseInt(u.getUserId()), grpName, grpMembers, icon))); GroupDAO grp1 = new GroupDAOImpl(); setGrpList(grp1.getAllGroups(Integer.parseInt(u.getUserId()))); System.out.println("after creation group id" + group_id); return "success"; }
public String getAllGroups() { System.out.println("groups"); HttpSession session = ServletActionContext.getRequest().getSession(false); User u = (User) session.getAttribute("user"); GroupDAO grp = new GroupDAOImpl(); setGrpList(grp.getAllGroups(Integer.parseInt(u.getUserId()))); int i = 0; while (i < grpList.size()) { System.out.println(grpList.get(i).getGroup_id()); i++; } // HttpServletRequest request=ServletActionContext.getRequest(); // request.setAttribute("grpList",grpList); return "success"; }
public String getGroupMembers() { System.out.println("group_id" + group_id); if (group_id != null) { HttpSession session = ServletActionContext.getRequest().getSession(false); User u = (User) session.getAttribute("user"); GroupDAO grp = new GroupDAOImpl(); setGrpMemberList(grp.getGroupMembers(group_id)); setDisplay_members("True"); getGroupDetail(); int i = 0; System.out.println("group members"); while (i < grpMemberList.size()) { System.out.println("member" + grpMemberList.get(i).getFirstName()); i++; } } return "success"; }