Пример #1
0
 @Override
 protected void validate(Schedule domain) {
   try {
     DomainUtil.checkingForNotNull(domain.getWeek());
     DomainUtil.checkingForNotNull(domain.getDayOfWeek());
     DomainUtil.checkingForNotNull(domain.getStudyId());
     DomainUtil.checkingForNotNull(domain.getClassroomId());
     DomainUtil.checkingForNotNull(domain.getDisciplineTimeId());
   } catch (NullPropertyException e) {
     throw new RestServiceException(Response.Status.BAD_REQUEST.getStatusCode());
   }
 }
Пример #2
0
 @GET
 @Path("/{id}/classroom")
 @Produces(MediaType.APPLICATION_JSON)
 public Response getClassroom(@PathParam("id") long id) {
   try {
     Schedule domain = getService().get(id);
     DomainUtil.checkingForNotNull(domain);
     return Response.ok(domain.getClassroom()).header("Content-Encoding", "utf-8").build();
   } catch (BusinessServiceException e) {
     throw new RestServiceException(e.getErrorCode());
   } catch (NullPropertyException e) {
     return Response.noContent().build();
   }
 }