Search in sources :

Example 1 with AttendanceResultResourceLinks

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

the class AttendanceResultResource method getAttendanceResult.

@GET
public Response getAttendanceResult(@PathParam("attendanceId") long attendanceId) {
    try {
        AttendanceResultResourceLinks resultResourceLinks = new AttendanceResultResourceLinks(uriInfo);
        AttendanceResult result = attendanceService.getAttendanceResultByAttendanceAndStudentId(attendanceId, 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 : AttendanceResultResourceLinks(com.remswork.project.alice.resource.links.AttendanceResultResourceLinks) Message(com.remswork.project.alice.model.support.Message) GradingFactorException(com.remswork.project.alice.exception.GradingFactorException) AttendanceResult(com.remswork.project.alice.model.AttendanceResult)

Example 2 with AttendanceResultResourceLinks

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

the class AttendanceResultResource method addAttendanceResult.

@POST
public Response addAttendanceResult(@QueryParam("status") int status, @PathParam("attendanceId") long attendanceId) {
    try {
        AttendanceResultResourceLinks resultResourceLinks = new AttendanceResultResourceLinks(uriInfo);
        AttendanceResult result = attendanceService.addAttendanceResult(status, attendanceId, 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 : AttendanceResultResourceLinks(com.remswork.project.alice.resource.links.AttendanceResultResourceLinks) Message(com.remswork.project.alice.model.support.Message) GradingFactorException(com.remswork.project.alice.exception.GradingFactorException) AttendanceResult(com.remswork.project.alice.model.AttendanceResult)

Example 3 with AttendanceResultResourceLinks

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

the class AttendanceResultResource method updateAttendanceResult.

@PUT
public Response updateAttendanceResult(@PathParam("attendanceId") long attendanceId, @QueryParam("status") int status) {
    try {
        AttendanceResultResourceLinks resultResourceLinks = new AttendanceResultResourceLinks(uriInfo);
        AttendanceResult result = attendanceService.updateAttendanceResultByAttendanceAndStudentId(status, attendanceId, 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 : AttendanceResultResourceLinks(com.remswork.project.alice.resource.links.AttendanceResultResourceLinks) Message(com.remswork.project.alice.model.support.Message) GradingFactorException(com.remswork.project.alice.exception.GradingFactorException) AttendanceResult(com.remswork.project.alice.model.AttendanceResult)

Example 4 with AttendanceResultResourceLinks

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

the class AttendanceResultResource method deleteAttendanceResult.

@DELETE
public Response deleteAttendanceResult(@PathParam("attendanceId") long attendanceId) {
    try {
        AttendanceResultResourceLinks resultResourceLinks = new AttendanceResultResourceLinks(uriInfo);
        AttendanceResult result = attendanceService.deleteAttendanceResultByAttendanceAndStudentId(attendanceId, 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 : AttendanceResultResourceLinks(com.remswork.project.alice.resource.links.AttendanceResultResourceLinks) Message(com.remswork.project.alice.model.support.Message) GradingFactorException(com.remswork.project.alice.exception.GradingFactorException) AttendanceResult(com.remswork.project.alice.model.AttendanceResult)

Aggregations

GradingFactorException (com.remswork.project.alice.exception.GradingFactorException)4 AttendanceResult (com.remswork.project.alice.model.AttendanceResult)4 Message (com.remswork.project.alice.model.support.Message)4 AttendanceResultResourceLinks (com.remswork.project.alice.resource.links.AttendanceResultResourceLinks)4