Search in sources :

Example 36 with Schedule

use of com.remswork.project.alice.model.Schedule in project classify-system by anverliedoit.

the class ScheduleResource method getScheduleListByTeacherId.

@GET
@Path("1")
public Response getScheduleListByTeacherId(@QueryParam("teacherId") long teacherId) {
    try {
        ScheduleResourceLinks resourceLinks = new ScheduleResourceLinks(uriInfo);
        Set<Schedule> scheduleSet = scheduleService.getScheduleListByTeacherId(teacherId);
        for (Schedule schedule : scheduleSet) schedule.addLink(resourceLinks.self(schedule.getId()));
        GenericEntity<Set<Schedule>> entity = new GenericEntity<Set<Schedule>>(scheduleSet) {
        };
        return Response.status(Response.Status.OK).entity(entity).build();
    } catch (ScheduleException e) {
        e.printStackTrace();
        Message message = new Message(404, "Not Found", e.getMessage());
        return Response.status(Response.Status.NOT_FOUND).entity(message).build();
    }
}
Also used : Set(java.util.Set) Message(com.remswork.project.alice.model.support.Message) Schedule(com.remswork.project.alice.model.Schedule) ScheduleResourceLinks(com.remswork.project.alice.resource.links.ScheduleResourceLinks) ScheduleException(com.remswork.project.alice.exception.ScheduleException)

Aggregations

Schedule (com.remswork.project.alice.model.Schedule)36 ScheduleException (com.remswork.project.alice.exception.ScheduleException)22 Message (com.remswork.project.alice.model.support.Message)22 ClassException (com.remswork.project.alice.exception.ClassException)13 Client (javax.ws.rs.client.Client)10 WebTarget (javax.ws.rs.client.WebTarget)10 Response (javax.ws.rs.core.Response)10 ScheduleServiceException (com.remswork.project.alice.web.service.exception.ScheduleServiceException)6 ScheduleResourceLinks (com.remswork.project.alice.resource.links.ScheduleResourceLinks)5 ArrayList (java.util.ArrayList)5 ClientBuilder (javax.ws.rs.client.ClientBuilder)5 Builder (javax.ws.rs.client.Invocation.Builder)5 Session (org.hibernate.Session)5 ScheduleDaoException (com.remswork.project.alice.dao.exception.ScheduleDaoException)4 ClassScheduleListResourceLinks (com.remswork.project.alice.resource.links.ClassScheduleListResourceLinks)4 ClassServiceException (com.remswork.project.alice.web.service.exception.ClassServiceException)4 Set (java.util.Set)4 AsyncTask (android.os.AsyncTask)3 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)3 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)3