use of com.remswork.project.alice.exception.GradingFactorException in project classify-system by anverliedoit.
the class RecitationResource method addRecitation.
@POST
public Response addRecitation(Recitation recitation) {
try {
RecitationResourceLinks resourceLinks = new RecitationResourceLinks(uriInfo);
ClassResourceLinks classResourceLinks = new ClassResourceLinks(uriInfo);
if (termId > 0)
recitation = recitationService.addRecitation(recitation, classId, termId);
else
recitation = recitationService.addRecitation(recitation, classId);
recitation.addLink(resourceLinks.self(recitation.getId()));
if (recitation.get_class() != null)
recitation.get_class().addLink(classResourceLinks.self(recitation.get_class().getId()));
return Response.status(Response.Status.CREATED).entity(recitation).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();
}
}
use of com.remswork.project.alice.exception.GradingFactorException 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();
}
}
use of com.remswork.project.alice.exception.GradingFactorException 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();
}
}
use of com.remswork.project.alice.exception.GradingFactorException in project classify-system by anverliedoit.
the class TermResource method addTerm.
@POST
public Response addTerm(Term term) {
try {
TermResourceLinks resourceLinks = new TermResourceLinks(uriInfo);
term = termService.addTerm(term);
term.addLink(resourceLinks.self(term.getId()));
return Response.status(Response.Status.CREATED).entity(term).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();
}
}
use of com.remswork.project.alice.exception.GradingFactorException in project classify-system by anverliedoit.
the class TermResource method getTermList.
@GET
public Response getTermList() {
try {
TermResourceLinks resourceLinks = new TermResourceLinks(uriInfo);
List<Term> termList = termService.getTermList();
for (Term term : termList) term.addLink(resourceLinks.self(term.getId()));
GenericEntity<List<Term>> entity = new GenericEntity<List<Term>>(termList) {
};
return Response.status(Response.Status.OK).entity(entity).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();
}
}
Aggregations