@Init private void init() { this.createExtension = new ModelCreateExtension(createHandler, createInterceptors); this.updateExtension = new ModelUpdateExtension(updateHandler, updateInterceptors, replaceInterceptors); this.queryExtension = new ModelQueryExtension(queryHandler, queryInterceptors); this.deleteExtension = new ModelDeleteExtension(deleteHandler, deleteInterceptors); this.relationQueryExtension = new RelationQueryExtension(relationQueryInterceptors); }
@Override public QueryOneResult queryOne(Object id, QueryOptionsBase options) { if (remoteRest) { RestResource restResource = restResourceFactory.createResource(dao.getOrmContext(), em); Record record = restResource.find(id, options); return new QueryOneResult(record); } ModelExecutionContext context = new DefaultModelExecutionContext(this.context); if (null != ex.handler) { ex.handler.processQueryOneOptions(context, id, options); } Record record; CriteriaQuery<Record> query = createCriteriaQuery().whereById(id); applySelect(query, options, new HashMap<>()); ex.preQueryOne(context, id, query); if (null != ex.handler) { ex.handler.preQueryOne(context, id, query); } record = query.firstOrNull(); expandOne(record, options); if (null != ex.handler && null != record) { ex.handler.postQueryOne(context, id, record); } Object entity = ex.processQueryOneRecord(context, id, record); return new QueryOneResult(record, entity); }
ex.processQueryListOptions(context, options); if (null != ex.handler) { ex.handler.processQueryListOptions(context, options); ex.preQueryList(context, query); if (null != ex.handler) { ex.handler.preQueryList(context, query); list = ex.executeQueryList(context, options, query); if (null == list) { list = page.list(); Object entity = ex.processQueryListResult(context, page, count, list);
ex.handler.preProcessQueryListWhere(context, options, whereExpr1, whereArgs1); ex.preProcessQueryListWhere(context, options, whereExpr1, whereArgs1); ex.handler.postProcessQueryListWhere(context, options, whereExpr1, whereArgs1); ex.postProcessQueryListWhere(context, options, whereExpr1, whereArgs1);