@SuppressWarnings({ "unchecked", "rawtypes" })
@GET
@Path("/{c_id}/session")
@Produces({ BASE_JSON_MEDIA_TYPE, BASE_XML_MEDIA_TYPE })
public Response getSessions(@PathParam("c_id") String conferenceId) {
Conference conference = getRepository().get(conferenceId);
if (conference == null) {
return Response.status(Status.BAD_REQUEST).build(); // TODO: Need Business Exception type to explain why?
}
Collection<SessionRepresentation> sessions = sessionConverter.from(getUriInfo(), (Collection)conference.getSessions());
return Response.ok(new GenericEntity<Collection<SessionRepresentation>>(sessions){})
.type(matchMediaType(
SessionResource.SESSION_XML_MEDIA_TYPE,
SessionResource.SESSION_JSON_MEDIA_TYPE))