예제 #1
0
 @Override
 public long getProjectListNum(User user) {
   if (user != null && user.isUserInRole("admin")) {
     user = null;
   }
   return projectDao.getProjectListNum(user);
 }
예제 #2
0
  @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;
  }
예제 #3
0
 @Override
 public List<Project> getProjectList(User user, int curPageNum, int pageSize) {
   List<Project> projectList = projectDao.getProjectList(user, curPageNum, pageSize);
   for (Project p : projectList) {
     if (user.isUserInRole("admin") || p.getUser().getId() == user.getId()) p.setIsManagable(true);
   }
   return projectList;
 }
예제 #4
0
 @Override
 public List<Action> getMatchedActionList(int projectId, String pattern) {
   List<Action> actionList = projectDao.getMatchedActionList(projectId, pattern);
   if (actionList == null || actionList.size() == 0) {
     Project project = projectDao.getProject(projectId);
     if (project != null) {
       String ids = project.getRelatedIds();
       if (ids != null && !ids.isEmpty()) {
         String[] arr = ids.split(",");
         for (String id : arr) {
           actionList = projectDao.getMatchedActionList(Integer.parseInt(id), pattern);
           if (actionList != null && actionList.size() != 0) {
             return actionList;
           }
         }
       }
     }
   }
   return actionList;
 }
예제 #5
0
 @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;
 }
예제 #6
0
  @Override
  public int updateProject(Project outerProject) {
    Project project = getProject(outerProject.getId());
    project.setName(outerProject.getName());
    project.setIntroduction(outerProject.getIntroduction());
    project.setUpdateTime(new Date());

    if (outerProject.getMemberAccountList() != null) {
      // adding new ones
      for (String account : outerProject.getMemberAccountList()) {
        User user = accountDao.getUser(account);
        if (user != null) {
          boolean addSuccess = project.addMember(user);
          if (addSuccess) {
            Notification o = new Notification();
            o.setTypeId((short) 2);
            o.setTargetUser(outerProject.getUser());
            o.setUser(user);
            o.setParam1(new Integer(outerProject.getId()).toString());
            o.setParam2(outerProject.getName());
            accountMgr.addNotification(o);
          }
        }
      }

      if (project.getUserList() != null) {
        // remove old ones
        List<User> userListToBeRemoved = new ArrayList<User>();
        for (User user : project.getUserList()) {
          if (!outerProject.getMemberAccountList().contains(user.getAccount())) {
            userListToBeRemoved.add(user);
          }
        }

        for (User user : userListToBeRemoved) {
          project.removeMember(user);
        }
      }
    }

    return projectDao.updateProject(project);
  }
예제 #7
0
 @Override
 public List<Project> selectMockNumTopNProjectList(int limit) {
   return projectDao.selectMockNumTopNProjectList(limit);
 }
예제 #8
0
 @Override
 public long getMockNumInTotal() {
   return projectDao.getMockNumInTotal();
 }
예제 #9
0
 @Override
 public long getCheckInNum() {
   return projectDao.getCheckInNum();
 }
예제 #10
0
 @Override
 public long getParametertNum() {
   return projectDao.getParametertNum();
 }
예제 #11
0
 @Override
 public long getActionNum() {
   return projectDao.getActionNum();
 }
예제 #12
0
 @Override
 public long getPageNum() {
   return projectDao.getPageNum();
 }
예제 #13
0
 @Override
 public Page getPage(int id) {
   return projectDao.getPage(id);
 }
예제 #14
0
 @Override
 public long getProjectNum() {
   return projectDao.getProjectListNum();
 }
예제 #15
0
 @Override
 public Action getAction(long id) {
   return projectDao.getAction(id);
 }
예제 #16
0
 @Override
 public List<Project> search(String key) {
   return projectDao.search(key);
 }
예제 #17
0
 @Override
 public List<Project> getProjectListByGroup(int id) {
   return projectDao.getProjectListByGroup(id);
 }
예제 #18
0
 @Override
 public Module getModule(int id) {
   return projectDao.getModule(id);
 }
예제 #19
0
 @Override
 public Project getProject(int id) {
   return projectDao.getProject(id);
 }
예제 #20
0
 @Override
 public long getModuleNum() {
   return projectDao.getModuleNum();
 }
예제 #21
0
 @Override
 public List<Project> getProjectList() {
   return projectDao.getProjectList();
 }
예제 #22
0
 @Override
 public String updateProject(
     int id, String projectData, String deletedObjectListData, Map<Long, Long> actionIdMap) {
   return projectDao.updateProject(id, projectData, deletedObjectListData, actionIdMap);
 }