/** * Gets the record of the specified id. */ protected ApiResponse get(Object id, QueryOptionsBase options) { ModelQueryExecutor executor = mef.newQueryExecutor(mec); QueryOneResult result = executor.queryOne(id, options); return ApiResponse.of(result.getRecord()); }
@Override public Object apply(ActionParams params) { MApiModel am = am(); ModelExecutorContext context = new SimpleModelExecutorContext(api, dao, am, em, params); ModelQueryExecutor executor = newQueryExecutor(context); Object id = id(params); QueryOptionsBase options = getWithId(params, 0); QueryOneResult result = executor.queryOne(id, options); if (null != result.getEntity()) { return ApiResponse.of(result.getEntity()); } else if (result.getRecord() == null) { throw new NotFoundException(am.getName() + " '" + id.toString() + "' not found"); } else { return ApiResponse.of(result.getRecord()); } }