private void update( String client, ProgramProp programProp, HttpServletRequest request, HttpServletResponse response) throws IOException { programProp = Program.setSpecialInstruction( client, programProp.programId, ServletUtils.getStrParam(request, "specialInstruction")); List<String> batch1SessionTimings = new ArrayList<>(); batch1SessionTimings.addAll(ServletUtils.getStringParamsAsSet(request, "batch1SessionTimings")); Collections.sort(batch1SessionTimings); programProp = Program.setSessionTimings( client, programProp.programId, batch1SessionTimings, null, null, null, null); programProp = Program.setMaxParticipants( client, programProp.programId, ServletUtils.getIntParam(request, "maxParticipants")); programProp = Program.setDisabled( client, programProp.programId, ServletUtils.getBoolParam(request, "disabled")); ServletUtils.setJson(response, new APIResponse().status(Status.SUCCESS).object(programProp)); }
private void queryDetailed( String client, String login, HttpServletRequest request, HttpServletResponse response) throws IOException { Set<Long> groupIds = new HashSet<>(); groupIds.add( Group.safeGetByIdOrName(client, ServletUtils.getStrParam(request, "group")) .toProp() .groupId); List<ProgramProp> programProps = Program.query( client, ServletUtils.getIntParam(request, "startYYYYMMDD"), ServletUtils.getIntParam(request, "endYYYYMMDD"), ServletUtils.getLongParamsAsSet(request, "programTypeId"), groupIds, null, null); for (ProgramProp programProp : programProps) { programProp.regSummary = Registration.getSummary(client, programProp.programId, User.SUPER_USER); } ServletUtils.setJson(response, new APIResponse().status(Status.SUCCESS).object(programProps)); }
private void create( String client, String login, HttpServletRequest request, HttpServletResponse response) throws IOException { long groupId = Group.safeGetByIdOrName(client, ServletUtils.getStrParam(request, "group")) .toProp() .groupId; ProgramProp programProp = Program.create( client, groupId, ServletUtils.getLongParam(request, "programTypeId"), ServletUtils.getLongParam(request, "venueId"), ServletUtils.getLongParam(request, "teacherId"), ServletUtils.getIntParam(request, "startYYYYMMDD"), ServletUtils.getIntParam(request, "endYYYYMMDD"), 1, "", ServletUtils.getDoubleParam(request, "fee"), Utils.Currency.SGD, login); update(client, programProp, request, response); }
private void get( String client, String login, HttpServletRequest request, HttpServletResponse response) throws IOException { ProgramProp programProp = Program.safeGet(client, ServletUtils.getLongParam(request, "programId")).toProp(client); ServletUtils.setJson(response, new APIResponse().status(Status.SUCCESS).object(programProp)); }
private void getOngoingSessions( String client, String login, HttpServletRequest request, HttpServletResponse response) throws IOException { List<SessionProp> sessionProps = Program.getOngoingSessions( client, ServletUtils.getIntParam(request, "dateYYYYMMDD"), login); ServletUtils.setJson(response, new APIResponse().status(Status.SUCCESS).object(sessionProps)); }
private void update( String client, String login, HttpServletRequest request, HttpServletResponse response) throws IOException { ProgramProp programProp = Program.update( client, ServletUtils.getLongParam(request, "programId"), ServletUtils.getLongParam(request, "venueId"), ServletUtils.getLongParam(request, "teacherId"), ServletUtils.getIntParam(request, "startYYYYMMDD"), ServletUtils.getIntParam(request, "endYYYYMMDD"), 1, "", ServletUtils.getDoubleParam(request, "fee"), Utils.Currency.SGD, login); update(client, programProp, request, response); }