criteria.addSortStartTime(PageOrdering.DESC);
List<Availability> points = availMgr.findAvailabilityByCriteria(caller, criteria);
List<AvailabilityRest> ret = new ArrayList<AvailabilityRest>(points.size());
for (Availability avail : points) {
AvailabilityRest availabilityRest;
if (avail.getAvailabilityType() != null) {
availabilityRest = new AvailabilityRest(avail.getAvailabilityType(), avail.getStartTime(), avail
.getResource().getId());
}
else {
availabilityRest = new AvailabilityRest(avail.getStartTime(), resourceId);
}
if (avail.getEndTime()!=null)
availabilityRest.setUntil(avail.getEndTime());
ret.add(availabilityRest);
}
MediaType mediaType = headers.getAcceptableMediaTypes().get(0);
Response.ResponseBuilder builder;