public TeamDetails getTeam(String salesRepuserId) { TeamDetails objTeamDetails = new TeamDetails(); try { UserDAO objUserDAO = new UserDAO(); RolesDAO objRolesDAO = new RolesDAO(); UsersVO objSalesRep = objUserDAO.getUsers(salesRepuserId); String roleName = objRolesDAO.getRoleName(objSalesRep.getUserId()); UsersVO objSalesManager = null; if (roleName.equals("SALES REP")) { if (objSalesRep != null) { objSalesManager = objSalesRep.getParentUser(); } objTeamDetails.setSalesRep(objSalesRep); objTeamDetails.setSalesManager(objSalesManager); objTeamDetails.setPricingAnalyst(objSalesManager.getParentUser()); } else if (roleName.equals("SALES MANAGER")) { objTeamDetails.setSalesRep(objSalesRep); objTeamDetails.setSalesManager(objSalesRep); objSalesManager = objSalesRep; objTeamDetails.setPricingAnalyst(objSalesManager.getParentUser()); } else { objTeamDetails.setSalesRep(objSalesRep); objTeamDetails.setSalesManager(objSalesRep); objTeamDetails.setPricingAnalyst(objSalesRep); } } catch (Exception e) { e.printStackTrace(); } return objTeamDetails; }
public String getTeamMembers(String userId) { String team = ""; if (!userId.equals("")) { try { TeamDetails objteam = new TeamDetails(); objteam = getTeam(userId); String salesMgr = objteam.getSalesManager().getUserId().trim(); String salesAnalyst = objteam.getPricingAnalyst().getUserId().trim(); team += salesMgr + "@#$" + salesAnalyst; } catch (Exception e) { e.printStackTrace(); } } return team; }