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();
}
}
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();
}
}
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();
}
}
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();
}
}
Aggregations