Search in sources :

Example 1 with RecitationResult

use of com.remswork.project.alice.model.RecitationResult in project classify-system by anverliedoit.

the class RecitationResultResource method addRecitationResult.

@POST
public Response addRecitationResult(@QueryParam("score") int score, @PathParam("recitationId") long recitationId) {
    try {
        RecitationResultResourceLinks resultResourceLinks = new RecitationResultResourceLinks(uriInfo);
        RecitationResult result = recitationService.addRecitationResult(score, recitationId, 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();
    }
}
Also used : Message(com.remswork.project.alice.model.support.Message) RecitationResultResourceLinks(com.remswork.project.alice.resource.links.RecitationResultResourceLinks) GradingFactorException(com.remswork.project.alice.exception.GradingFactorException) RecitationResult(com.remswork.project.alice.model.RecitationResult)

Example 2 with RecitationResult

use of com.remswork.project.alice.model.RecitationResult in project classify-system by anverliedoit.

the class RecitationResultResource method deleteRecitationResult.

@DELETE
public Response deleteRecitationResult(@PathParam("recitationId") long recitationId) {
    try {
        RecitationResultResourceLinks resultResourceLinks = new RecitationResultResourceLinks(uriInfo);
        RecitationResult result = recitationService.deleteRecitationResultByRecitationAndStudentId(recitationId, 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();
    }
}
Also used : Message(com.remswork.project.alice.model.support.Message) RecitationResultResourceLinks(com.remswork.project.alice.resource.links.RecitationResultResourceLinks) GradingFactorException(com.remswork.project.alice.exception.GradingFactorException) RecitationResult(com.remswork.project.alice.model.RecitationResult)

Example 3 with RecitationResult

use of com.remswork.project.alice.model.RecitationResult in project classify-system by anverliedoit.

the class RecitationResultResource method getRecitationResult.

@GET
public Response getRecitationResult(@PathParam("recitationId") long recitationId) {
    try {
        RecitationResultResourceLinks resultResourceLinks = new RecitationResultResourceLinks(uriInfo);
        RecitationResult result = recitationService.getRecitationResultByRecitationAndStudentId(recitationId, 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();
    }
}
Also used : Message(com.remswork.project.alice.model.support.Message) RecitationResultResourceLinks(com.remswork.project.alice.resource.links.RecitationResultResourceLinks) GradingFactorException(com.remswork.project.alice.exception.GradingFactorException) RecitationResult(com.remswork.project.alice.model.RecitationResult)

Example 4 with RecitationResult

use of com.remswork.project.alice.model.RecitationResult in project classify-system by anverliedoit.

the class RecitationResultResource method updateRecitationResult.

@PUT
public Response updateRecitationResult(@PathParam("recitationId") long recitationId, @QueryParam("score") int score) {
    try {
        RecitationResultResourceLinks resultResourceLinks = new RecitationResultResourceLinks(uriInfo);
        RecitationResult result = recitationService.updateRecitationResultByRecitationAndStudentId(score, recitationId, 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();
    }
}
Also used : Message(com.remswork.project.alice.model.support.Message) RecitationResultResourceLinks(com.remswork.project.alice.resource.links.RecitationResultResourceLinks) GradingFactorException(com.remswork.project.alice.exception.GradingFactorException) RecitationResult(com.remswork.project.alice.model.RecitationResult)

Aggregations

GradingFactorException (com.remswork.project.alice.exception.GradingFactorException)4 RecitationResult (com.remswork.project.alice.model.RecitationResult)4 Message (com.remswork.project.alice.model.support.Message)4 RecitationResultResourceLinks (com.remswork.project.alice.resource.links.RecitationResultResourceLinks)4