@Path("{id}/split") @POST public Response split( @PathParam("id") final String signupId, @FormParam("componentPresentationId") final Set<String> componentIds) { checkAuthenticated(); try { String newSignupId = courseService.split(signupId, componentIds); return Response.status(Response.Status.CREATED).entity(newSignupId).build(); } catch (IllegalArgumentException iae) { throw new CourseSignupException(iae.getMessage(), iae); } }
/** * Make a new signup for the current user. * * @param courseId the courseId of the signup * @param components the components to sign up to * @param email the email of the supervisor * @param message the reason for the signup * @param specialReq any special requirements * @return CourseSignup the coursesignup object created */ @Path("/my/new") @POST @Produces(MediaType.APPLICATION_JSON) public Response signup( @FormParam("courseId") String courseId, @FormParam("components") Set<String> components, @FormParam("email") String email, @FormParam("message") String message, @FormParam("specialReq") String specialReq) { checkAuthenticated(); try { CourseSignup entity = courseService.signup(courseId, components, email, message, specialReq); ResponseBuilder builder = Response.status(Response.Status.CREATED); builder.entity(entity); return builder.build(); } catch (IllegalStateException e) { throw new WebAppBadRequestException(new FailureMessage(e.getMessage())); } catch (IllegalArgumentException e) { throw new WebAppBadRequestException(new FailureMessage(e.getMessage())); } }