private Inflector<ContainerRequestContext, Response> listTypesHandler() {
return new Inflector<ContainerRequestContext, Response>() {
public Response apply(ContainerRequestContext ctx) {
String appid = RestUtils.getPrincipalAppid(ctx.getSecurityContext().getUserPrincipal());
App app = dao.read(new App(appid).getId());
if (app != null) {
Map<String, String> allTypes = new HashMap<String, String>(app.getDatatypes());
allTypes.putAll(coreTypes);
return Response.ok(allTypes).build();
}
return RestUtils.getStatusResponse(Response.Status.NOT_FOUND, "App not found: " + appid);
}