Search in sources :

Example 1 with ProjectResultResourceLinks

use of com.remswork.project.alice.resource.links.ProjectResultResourceLinks in project classify-system by anverliedoit.

the class ProjectResultResource method deleteProjectResult.

@DELETE
public Response deleteProjectResult(@PathParam("projectId") long projectId) {
    try {
        ProjectResultResourceLinks resultResourceLinks = new ProjectResultResourceLinks(uriInfo);
        ProjectResult result = projectService.deleteProjectResultByProjectAndStudentId(projectId, 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) ProjectResultResourceLinks(com.remswork.project.alice.resource.links.ProjectResultResourceLinks) ProjectResult(com.remswork.project.alice.model.ProjectResult)

Example 2 with ProjectResultResourceLinks

use of com.remswork.project.alice.resource.links.ProjectResultResourceLinks in project classify-system by anverliedoit.

the class ProjectResultResource method addProjectResult.

@POST
public Response addProjectResult(@QueryParam("score") int score, @PathParam("projectId") long projectId) {
    try {
        ProjectResultResourceLinks resultResourceLinks = new ProjectResultResourceLinks(uriInfo);
        ProjectResult result = projectService.addProjectResult(score, projectId, 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) ProjectResultResourceLinks(com.remswork.project.alice.resource.links.ProjectResultResourceLinks) ProjectResult(com.remswork.project.alice.model.ProjectResult)

Example 3 with ProjectResultResourceLinks

use of com.remswork.project.alice.resource.links.ProjectResultResourceLinks in project classify-system by anverliedoit.

the class ProjectResultResource method updateProjectResult.

@PUT
public Response updateProjectResult(@PathParam("projectId") long projectId, @QueryParam("score") int score) {
    try {
        ProjectResultResourceLinks resultResourceLinks = new ProjectResultResourceLinks(uriInfo);
        ProjectResult result = projectService.updateProjectResultByProjectAndStudentId(score, projectId, 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) ProjectResultResourceLinks(com.remswork.project.alice.resource.links.ProjectResultResourceLinks) ProjectResult(com.remswork.project.alice.model.ProjectResult)

Example 4 with ProjectResultResourceLinks

use of com.remswork.project.alice.resource.links.ProjectResultResourceLinks in project classify-system by anverliedoit.

the class ProjectResultResource method getProjectResult.

@GET
public Response getProjectResult(@PathParam("projectId") long projectId) {
    try {
        ProjectResultResourceLinks resultResourceLinks = new ProjectResultResourceLinks(uriInfo);
        ProjectResult result = projectService.getProjectResultByProjectAndStudentId(projectId, 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) ProjectResultResourceLinks(com.remswork.project.alice.resource.links.ProjectResultResourceLinks) ProjectResult(com.remswork.project.alice.model.ProjectResult)

Aggregations

GradingFactorException (com.remswork.project.alice.exception.GradingFactorException)4 ProjectResult (com.remswork.project.alice.model.ProjectResult)4 Message (com.remswork.project.alice.model.support.Message)4 ProjectResultResourceLinks (com.remswork.project.alice.resource.links.ProjectResultResourceLinks)4