use of com.remswork.project.alice.resource.links.QuizResultResourceLinks in project classify-system by anverliedoit.
the class QuizResultResource method getQuizResult.
@GET
public Response getQuizResult(@PathParam("quizId") long quizId) {
try {
QuizResultResourceLinks resultResourceLinks = new QuizResultResourceLinks(uriInfo);
QuizResult result = quizService.getQuizResultByQuizAndStudentId(quizId, studentId);
result.addLink(resultResourceLinks.self(result.getId()));
return Response.status(Response.Status.OK).entity(result).build();
} catch (GradingFactorException e) {
e.printStackTrace();
Message message = new Message(404, "Not Found", e.getMessage());
return Response.status(Response.Status.NOT_FOUND).entity(message).build();
}
}
use of com.remswork.project.alice.resource.links.QuizResultResourceLinks in project classify-system by anverliedoit.
the class QuizResultResource method addQuizResult.
@POST
public Response addQuizResult(@QueryParam("score") int score, @PathParam("quizId") long quizId) {
try {
QuizResultResourceLinks resultResourceLinks = new QuizResultResourceLinks(uriInfo);
QuizResult result = quizService.addQuizResult(score, quizId, studentId);
result.addLink(resultResourceLinks.self(result.getId()));
return Response.status(Response.Status.OK).entity(result).build();
} catch (GradingFactorException e) {
e.printStackTrace();
Message message = new Message(404, "Not Found", e.getMessage());
return Response.status(Response.Status.NOT_FOUND).entity(message).build();
}
}
use of com.remswork.project.alice.resource.links.QuizResultResourceLinks in project classify-system by anverliedoit.
the class QuizResultResource method updateQuizResult.
@PUT
public Response updateQuizResult(@PathParam("quizId") long quizId, @QueryParam("score") int score) {
try {
QuizResultResourceLinks resultResourceLinks = new QuizResultResourceLinks(uriInfo);
QuizResult result = quizService.updateQuizResultByQuizAndStudentId(score, quizId, studentId);
result.addLink(resultResourceLinks.self(result.getId()));
return Response.status(Response.Status.OK).entity(result).build();
} catch (GradingFactorException e) {
e.printStackTrace();
Message message = new Message(400, "Bad Request", e.getMessage());
return Response.status(Response.Status.NOT_FOUND).entity(message).build();
}
}
use of com.remswork.project.alice.resource.links.QuizResultResourceLinks in project classify-system by anverliedoit.
the class QuizResultResource method deleteQuizResult.
@DELETE
public Response deleteQuizResult(@PathParam("quizId") long quizId) {
try {
QuizResultResourceLinks resultResourceLinks = new QuizResultResourceLinks(uriInfo);
QuizResult result = quizService.deleteQuizResultByQuizAndStudentId(quizId, studentId);
result.addLink(resultResourceLinks.self(result.getId()));
return Response.status(Response.Status.OK).entity(result).build();
} catch (GradingFactorException e) {
e.printStackTrace();
Message message = new Message(400, "Bad Request", e.getMessage());
return Response.status(Response.Status.BAD_REQUEST).entity(message).build();
}
}
Aggregations