/** * @see org.openmrs.module.webservices.rest.web.resource.api.Listable#getAll(org.openmrs.module.webservices.rest.web.RequestContext) */ @Override public SimpleObject getAll(RequestContext context) throws ResponseException { if (context.getType() != null) { if (!hasTypesDefined()) throw new IllegalArgumentException(getClass() + " does not support " + RestConstants.REQUEST_PROPERTY_FOR_TYPE); if (context.getType().equals(getResourceName())) throw new IllegalArgumentException("You may not specify " + RestConstants.REQUEST_PROPERTY_FOR_TYPE + "=" + context.getType() + " because it is the default behavior for this resource"); DelegatingSubclassHandler<T, ? extends T> handler = getSubclassHandler(context.getType()); if (handler == null) throw new IllegalArgumentException("No handler is specified for " + RestConstants.REQUEST_PROPERTY_FOR_TYPE + "=" + context.getType()); PageableResult result = handler.getAllByType(context); return result.toSimpleObject(this); } else { PageableResult result = doGetAll(context); return result.toSimpleObject(this); } }