Example #1
0
 @Override
 public void levelUp(Job job) {
   synchronized (this.lock) {
     if (job.getStatus().equals(JobImpl.NONSUBMITTED)) {
       job.setStatus(JobImpl.SUBMITTED);
       this.submitted.add(job);
       this.nonSubmitted.remove(job);
     } else if (job.getStatus().equals(JobImpl.SUBMITTED)) {
       job.setStatus(JobImpl.FINISHED);
       this.finished.add(job);
       this.submitted.remove(job);
     }
   }
 }
Example #2
0
 @RequestMapping(
     value = "/jobs/{jobId}/finalList",
     method = {RequestMethod.GET})
 public String visitFinalListPage(
     @PathVariable String jobId, HttpServletRequest request, ModelMap model) {
   User user = (User) request.getSession().getAttribute("user");
   if (user == null || !user.getRole().equals("manager")) {
     model.addAttribute("errorMsg", "User has no permission");
     return "login";
   }
   try {
     Job j = JobsDao.instance.getById(jobId);
     if (!j.getStatus().equals(RecruitmentStatus.SENT_INVITATIONS)) {
       return "redirect:/jobs";
     }
     List<Application> validApplications = new ArrayList<Application>();
     List<Application> applications =
         ApplicationsDao.instance.getByJob(ORSKEY, user.getShortKey(), jobId);
     for (Application a : applications) {
       if (a.getStatus().equals(ApplicationStatus.ACCEPTED_INVITATION)) {
         validApplications.add(a);
       }
     }
     model.addAttribute("applications", validApplications);
     model.addAttribute("job", j);
     return "finalList";
   } catch (Exception e) {
     e.printStackTrace();
     model.addAttribute("errorMsg", e.getMessage());
     return "error";
   }
 }
Example #3
0
 @RequestMapping(
     value = "/jobs/{jobId}/shortlist",
     method = {RequestMethod.GET})
 public String visitShortlistPage(
     @PathVariable String jobId, HttpServletRequest request, ModelMap model) {
   User user = (User) request.getSession().getAttribute("user");
   if (user == null || !user.getRole().equals("manager")) {
     model.addAttribute("errorMsg", "User has no permission");
     return "login";
   }
   try {
     Job j = JobsDao.instance.getById(jobId);
     if (j.getStatus().equals(RecruitmentStatus.CREATED)) {
       return "redirect:/jobs";
     }
     List<DetailedApplication> list = new ArrayList<DetailedApplication>();
     List<Application> applications =
         ApplicationsDao.instance.getByJob(ORSKEY, user.getShortKey(), jobId);
     for (Application a : applications) {
       DetailedApplication da = new DetailedApplication(a);
       da.setReviews(
           (ArrayList<Review>)
               ReviewsDao.instance.getByApplication(ORSKEY, user.getShortKey(), a.get_appId()));
       list.add(da);
     }
     model.addAttribute("applications", list);
     model.addAttribute("job", j);
     return "shortlist";
   } catch (Exception e) {
     e.printStackTrace();
     model.addAttribute("errorMsg", e.getMessage());
     return "error";
   }
 }
Example #4
0
 @RequestMapping(
     value = "/jobs/{jobId}/finalList",
     method = {RequestMethod.POST})
 public String submitfinalList(
     @PathVariable String jobId, HttpServletRequest request, ModelMap model) {
   User user = (User) request.getSession().getAttribute("user");
   if (user == null || !user.getRole().equals("manager")) {
     model.addAttribute("errorMsg", "User has no permission");
     return "login";
   }
   try {
     Job j = JobsDao.instance.getById(jobId);
     if (!j.getStatus().equals(RecruitmentStatus.SENT_INVITATIONS)) {
       return "redirect:/jobs";
     }
     List<Application> applications =
         ApplicationsDao.instance.getByJob(ORSKEY, user.getShortKey(), jobId);
     if (request.getParameter("selectedCandidate") != null) {
       for (Application a : applications) {
         if (a.getStatus().equals(ApplicationStatus.ARCHIVED)) {
           continue;
         }
         if (request.getParameter("selectedCandidate").equals(a.get_appId())) {
           // TODO send notifications
         } else {
           // TODO send notifications
         }
         a.setStatus(ApplicationStatus.FINALISED);
         ApplicationsDao.instance.update(a);
       }
       j.setStatus(RecruitmentStatus.FINALISED);
       JobsDao.instance.update(ORSKEY, user.getShortKey(), j);
     }
     return "redirect:/jobs";
   } catch (Exception e) {
     e.printStackTrace();
     model.addAttribute("errorMsg", e.getMessage());
     return "error";
   }
 }