コード例 #1
0
 @RequestMapping(method = RequestMethod.GET)
 public AnnouncementsAdminView all(
     Model model,
     @PathVariable ExecutionCourse executionCourse,
     @RequestParam(required = false, defaultValue = "1") int page) {
   Professorship professorship = executionCourse.getProfessorship(AccessControl.getPerson());
   AccessControl.check(
       person -> professorship != null && professorship.getPermissions().getAnnouncements());
   List<Post> announcements = getAnnouncements(executionCourse.getSite());
   model.addAttribute("executionCourse", executionCourse);
   int pages = IntMath.divide(announcements.size(), PER_PAGE, RoundingMode.CEILING);
   if (page < 1) {
     page = 1;
   }
   if (page > pages) {
     page = pages;
   }
   model.addAttribute("currentPage", page);
   model.addAttribute("pages", pages);
   model.addAttribute(
       "announcements",
       announcements
           .stream()
           .skip((page - 1) * PER_PAGE)
           .limit(PER_PAGE)
           .collect(Collectors.toList()));
   model.addAttribute("professorship", professorship);
   return new AnnouncementsAdminView();
 }
コード例 #2
0
 @Atomic
 public static void run(
     final String attendsID,
     final Integer contact,
     final Integer autonomousStudy,
     final Integer other) {
   check(RolePredicates.STUDENT_PREDICATE);
   final Attends attends = FenixFramework.getDomainObject(attendsID);
   attends.createWeeklyWorkLoad(contact, autonomousStudy, other);
 }
コード例 #3
0
 @Atomic
 public static void run(
     final Person responsible, final CreateGratuityExemptionBean createGratuityExemptionBean) {
   check(AcademicPredicates.MANAGE_STUDENT_PAYMENTS);
   if (createGratuityExemptionBean.isPercentageExemption()) {
     new PercentageGratuityExemption(
         responsible,
         createGratuityExemptionBean.getGratuityEvent(),
         createGratuityExemptionBean.getExemptionJustificationType(),
         createGratuityExemptionBean.getReason(),
         createGratuityExemptionBean.getDispatchDate(),
         createGratuityExemptionBean.getSelectedPercentage().divide(BigDecimal.valueOf(100)));
   } else {
     new ValueGratuityExemption(
         responsible,
         createGratuityExemptionBean.getGratuityEvent(),
         createGratuityExemptionBean.getExemptionJustificationType(),
         createGratuityExemptionBean.getReason(),
         createGratuityExemptionBean.getDispatchDate(),
         createGratuityExemptionBean.getAmount());
   }
 }