Search in sources :

Example 1 with ActivityResult

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

the class ActivityResultResource method updateActivityResult.

@PUT
public Response updateActivityResult(@PathParam("activityId") long activityId, @QueryParam("score") int score) {
    try {
        ActivityResultResourceLinks resultResourceLinks = new ActivityResultResourceLinks(uriInfo);
        ActivityResult result = activityService.updateActivityResultByActivityAndStudentId(score, activityId, 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) GradingFactorException(com.remswork.project.alice.exception.GradingFactorException) ActivityResultResourceLinks(com.remswork.project.alice.resource.links.ActivityResultResourceLinks) ActivityResult(com.remswork.project.alice.model.ActivityResult)

Example 2 with ActivityResult

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

the class ActivityResultResource method addActivityResult.

@POST
public Response addActivityResult(@QueryParam("score") int score, @PathParam("activityId") long activityId) {
    try {
        ActivityResultResourceLinks resultResourceLinks = new ActivityResultResourceLinks(uriInfo);
        ActivityResult result = activityService.addActivityResult(score, activityId, 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) GradingFactorException(com.remswork.project.alice.exception.GradingFactorException) ActivityResultResourceLinks(com.remswork.project.alice.resource.links.ActivityResultResourceLinks) ActivityResult(com.remswork.project.alice.model.ActivityResult)

Example 3 with ActivityResult

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

the class ActivityResultResource method deleteActivityResult.

@DELETE
public Response deleteActivityResult(@PathParam("activityId") long activityId) {
    try {
        ActivityResultResourceLinks resultResourceLinks = new ActivityResultResourceLinks(uriInfo);
        ActivityResult result = activityService.deleteActivityResultByActivityAndStudentId(activityId, 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) GradingFactorException(com.remswork.project.alice.exception.GradingFactorException) ActivityResultResourceLinks(com.remswork.project.alice.resource.links.ActivityResultResourceLinks) ActivityResult(com.remswork.project.alice.model.ActivityResult)

Example 4 with ActivityResult

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

the class ActivityResultResource method getActivityResult.

@GET
public Response getActivityResult(@PathParam("activityId") long activityId) {
    try {
        ActivityResultResourceLinks resultResourceLinks = new ActivityResultResourceLinks(uriInfo);
        ActivityResult result = activityService.getActivityResultByActivityAndStudentId(activityId, 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) GradingFactorException(com.remswork.project.alice.exception.GradingFactorException) ActivityResultResourceLinks(com.remswork.project.alice.resource.links.ActivityResultResourceLinks) ActivityResult(com.remswork.project.alice.model.ActivityResult)

Aggregations

GradingFactorException (com.remswork.project.alice.exception.GradingFactorException)4 ActivityResult (com.remswork.project.alice.model.ActivityResult)4 Message (com.remswork.project.alice.model.support.Message)4 ActivityResultResourceLinks (com.remswork.project.alice.resource.links.ActivityResultResourceLinks)4