Exemplo n.º 1
0
  @RequestMapping("loadModel.htm")
  public void loadModel(HttpServletRequest request, HttpServletResponse response) throws Exception {
    String projectId = request.getParameter("projectId");

    Project project = aService.findById(Project.class, Integer.parseInt(projectId));

    List<ModuleBean> moduleBean = ModuleUtil.getModuleNameList(aService, project);

    JSONArray json = JSONArray.fromObject(moduleBean);
    PrintWriter pt = response.getWriter();
    pt.write(json.toString());
    System.out.println(json.toString());
    pt.close();
  }
Exemplo n.º 2
0
  @Secured({"ROLE_DEVELOPER", "ROLE_TESTER"})
  @RequestMapping("goeditBug.htm")
  public ModelAndView goeditBug(HttpServletRequest request) {
    String bugId = request.getParameter("bugId");

    Bug bug = aService.findById(Bug.class, Integer.parseInt(bugId));
    Project project = bug.getModule().getProject();
    List<ModuleBean> modulebean = ModuleUtil.getModuleNameList(aService, project);

    Company company = (Company) request.getSession().getAttribute("company");
    DetachedCriteria dCriteria1 = DetachedCriteria.forClass(Project.class);
    dCriteria1
        .add(Restrictions.eq("company", company))
        .add(Restrictions.ne("projectId", project.getProjectId()));
    List<Project> projectList = aService.queryAllOfCondition(Project.class, dCriteria1);

    DetachedCriteria dCriteria2 = DetachedCriteria.forClass(Version.class);
    dCriteria2.add(Restrictions.eq("project", project));
    List<Version> versionList = aService.queryAllOfCondition(Version.class, dCriteria2);

    DetachedCriteria dCriteria3 = DetachedCriteria.forClass(AffectedVersion.class);
    dCriteria3.add(Restrictions.eq("bug", bug));
    List<AffectedVersion> avList = aService.queryAllOfCondition(AffectedVersion.class, dCriteria3);

    List<Version> aList = new ArrayList<Version>();
    for (AffectedVersion aversion : avList) {
      aList.add(aversion.getVersion());
    }

    DetachedCriteria dCriteria5 = DetachedCriteria.forClass(Department.class);
    dCriteria5.add(Restrictions.eq("company", company));
    List<Department> deptList = aService.queryAllOfCondition(Department.class, dCriteria5);

    DetachedCriteria dCriteria4 =
        DetachedCriteria.forClass(Developer.class)
            .add(Restrictions.ne("developerId", bug.getAssignedTo().getDeveloperId()));
    dCriteria4.createCriteria("user").add(Restrictions.in("department", deptList));
    List<Developer> userList = aService.queryAllOfCondition(Developer.class, dCriteria4);

    DetachedCriteria dCriteria7 = DetachedCriteria.forClass(History.class);
    dCriteria7
        .add(Restrictions.eq("objectId", bug.getBugId()))
        .add(Restrictions.eq("objectType", "bug"))
        .addOrder(Order.asc("operateTime"));
    List<History> hisList = aService.queryAllOfCondition(History.class, dCriteria7);

    DetachedCriteria dCriteria6 = DetachedCriteria.forClass(User.class);
    dCriteria6.add(Restrictions.in("department", deptList));
    List<User> userList1 = aService.queryAllOfCondition(User.class, dCriteria6);
    String mailto = bug.getMailto();

    String[] name = mailto.split(";");
    List<User> userlist = new ArrayList<User>();
    for (int i = 0; i < name.length; i++) {
      User user1 = new User();
      user1.setRealName(name[i]);
      userlist.add(user1);
    }
    ModelMap map = new ModelMap();
    map.put("bug", bug);
    map.put("modulebean", modulebean);
    map.put("projectList", projectList);
    map.put("versionList", versionList);
    map.put("userlist", userlist);
    map.put("userList", userList);
    map.put("userList1", userList1);
    map.put("aList", aList);
    map.put("hisList", hisList);

    return new ModelAndView("/bug/editBug", map);
  }