use of gov.ca.cwds.rest.api.domain.ScreeningListResponse in project API by ca-cwds.
the class ScreeningService method find.
/**
* {@inheritDoc}
*
* @see gov.ca.cwds.rest.services.CrudsService#find(java.io.Serializable)
*/
@Override
public Response find(Serializable primaryKey) {
if (primaryKey instanceof Long) {
gov.ca.cwds.data.persistence.ns.Screening screening = screeningDao.find(primaryKey);
if (screening != null) {
return new ScreeningResponse(screening, screening.getParticipants());
}
return null;
} else {
List<gov.ca.cwds.data.persistence.ns.Screening> screenings = findByCriteria(primaryKey);
ImmutableSet.Builder<ScreeningResponse> builder = ImmutableSet.builder();
for (gov.ca.cwds.data.persistence.ns.Screening screening : screenings) {
if (screening != null) {
builder.add(new ScreeningResponse(screening, screening.getParticipants()));
}
}
return new ScreeningListResponse(builder.build());
}
}
Aggregations