@Override public int addProject(Project project) { project.setUpdateTime(new Date()); project.setCreateDate(new Date()); List<User> usersInformed = new ArrayList<User>(); for (String account : project.getMemberAccountList()) { User user = accountDao.getUser(account); if (user != null) { boolean addSuccess = project.addMember(user); if (addSuccess) { usersInformed.add(user); } } } int result = projectDao.addProject(project); for (User u : usersInformed) { Notification o = new Notification(); o.setTypeId((short) 2); o.setTargetUser(project.getUser()); o.setUser(u); o.setParam1(new Integer(result).toString()); o.setParam2(project.getName()); accountMgr.addNotification(o); } Group g = organizationDao.getGroup(project.getGroupId()); if (g.getProductionLineId() > 0) { organizationDao.updateCountersInProductionLine(g.getProductionLineId()); } return result; }
@Override public void updateGroup(Group group) { Group g = getGroup(group.getId()); if (g != null) { g.setName(group.getName()); getSession().update(g); } }
@Override public int removeProject(int id) { Project p = getProject(id); Group g = organizationDao.getGroup(p.getGroupId()); int result = projectDao.removeProject(id); if (g != null) { int pId = g.getProductionLineId(); if (pId > 0) { organizationDao.updateCountersInProductionLine(pId); } } return result; }